2 .\" Title: git-name-rev
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.37.1.223.g6a475b71f8
10 .TH "GIT\-NAME\-REV" "1" "07/22/2022" "Git 2\&.37\&.1\&.223\&.g6a475b" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-name-rev \- Find symbolic names for given revs
35 \fIgit name\-rev\fR [\-\-tags] [\-\-refs=<pattern>]
36 ( \-\-all | \-\-stdin | <commit\-ish>\&... )
41 Finds symbolic names suitable for human digestion for revisions given in any format parsable by \fIgit rev\-parse\fR\&.
46 Do not use branch names, but only tags to name the commits
51 Only use refs whose names match a given shell pattern\&. The pattern can be one of branch name, tag name or fully qualified ref name\&. If given multiple times, use refs whose names match any of the given shell patterns\&. Use
53 to clear any previous ref patterns given\&.
58 Do not use any ref whose name matches a given shell pattern\&. The pattern can be one of branch name, tag name or fully qualified ref name\&. If given multiple times, a ref will be excluded when it matches any of the given patterns\&. When used together with \-\-refs, a ref will be used as a match only when it matches at least one \-\-refs pattern and does not match any \-\-exclude patterns\&. Use
60 to clear the list of exclude patterns\&.
65 List all commits reachable from all refs
70 Transform stdin by substituting all the 40\-character SHA\-1 hexes (say $hex) with "$hex ($rev_name)"\&. When used with \-\-name\-only, substitute with "$rev_name", omitting $hex altogether\&.
80 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
81 The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907,
82 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
84 $ git name\-rev \-\-annotate\-stdin <sample\&.txt
86 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
87 The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907 (master),
88 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
90 $ git name\-rev \-\-name\-only \-\-annotate\-stdin <sample\&.txt
92 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
93 The full name after substitution is master,
94 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
104 This option is deprecated in favor of
105 \fIgit name\-rev \-\-annotate\-stdin\fR\&. They are functionally equivalent\&.
110 Instead of printing both the SHA\-1 and the name, print only the name\&. If given with \-\-tags the usual tag prefix of "tags/" is also omitted from the name, matching the output of
117 Die with error code != 0 when a reference is undefined, instead of printing
123 Show uniquely abbreviated commit object as fallback\&.
127 Given a commit, find out where it is relative to the local refs\&. Say somebody wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a\&. Of course, you look into the commit, but that only tells you what happened, but not the context\&.
129 Enter \fIgit name\-rev\fR:
135 % git name\-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
136 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0\&.99~940
143 Now you are wiser, because you know that it happened 940 revisions before v0\&.99\&.
145 Another nice thing you can do is:
151 % git log | git name\-rev \-\-stdin
159 Part of the \fBgit\fR(1) suite