From: Andy Whitcroft <apw@shadowen.org>
To: git@vger.kernel.org
Subject: [PATCH] document the <tree ish> <file> blob reference syntax
Date: Wed, 25 Oct 2006 11:42:31 +0100 [thread overview]
Message-ID: <38fafea491402334df335c486270ebe9@pinky> (raw)
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@shadowen.org>
---
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@osdl.org>
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
next reply other threads:[~2006-10-25 10:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-25 10:42 Andy Whitcroft [this message]
2006-10-25 18:33 ` [PATCH] document the <tree ish> <file> blob reference syntax Junio C Hamano
2006-10-25 19:40 ` Andy Whitcroft
2006-10-25 20:13 ` Junio C Hamano
2006-10-25 20:04 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38fafea491402334df335c486270ebe9@pinky \
--to=apw@shadowen.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).