[PATCH] document the <tree ish> <file> blob reference syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is possible to specify a specific file within a tree-ish
symbolically.  For example you can find the contents of
a specific file in a specific commit as below:

	git cat-file -p v1.2.4:git-prune.sh

Document this syntax in the Symbolic Identifiers section
of the main git documentation and reference it from
git-cat-file's documentation.

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx>
---
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index 5e9cbf8..9f2138d 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -19,7 +19,9 @@ or '-s' is used to find the object size.
 OPTIONS
 -------
 <object>::
-	The sha1 identifier of the object.
+	The sha1 identifier of the object or a symbolic object
+	reference.  See the Symbolic Identifiers section of the
+	main git manual page.
 
 -t::
 	Instead of the content, show the object type identified by
@@ -58,6 +60,18 @@ Otherwise the raw (though uncompressed) 
 be returned.
 
 
+EXAMPLES
+--------
+git cat-file -p c5a5d29aaacf753b70e715169cbb7f74f0193e4a::
+	Pretty print the object directly using an sha1, perhaps
+	from a git ls-tree output.
+
+git cat-file -p v1.2.4:git-prune.sh::
+	Output the file git-prune.sh from the branch or tag v1.2.4.
+	Note that where the name is ambigious a heads/ or tags/
+	prefix may be used to disambiguate the name.
+
+
 Author
 ------
 Written by Linus Torvalds <torvalds@xxxxxxxx>
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 7074e32..e9f99e2 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -565,6 +565,13 @@ HEAD::
 	a valid head 'name'
 	(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
 
+Some commands will also accept the following extended syntax:
+
+<tree-ish>:<file>::
+	indicating a specific blob for that file within the tree
+	object specified, which may also be symbolic.  For example
+	'v1.2.4:git-prune.sh'.
+
 
 File/Directory Structure
 ------------------------
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]