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.42.0.424.gceadf0f3cf
10 .TH "GIT\-NAME\-REV" "1" "2023\-10\-20" "Git 2\&.42\&.0\&.424\&.gceadf0" "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 | \-\-annotate\-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\&. This option was called
72 in older versions of Git\&.
82 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
83 The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907,
84 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
86 $ git name\-rev \-\-annotate\-stdin <sample\&.txt
88 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
89 The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907 (master),
90 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
92 $ git name\-rev \-\-name\-only \-\-annotate\-stdin <sample\&.txt
94 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
95 The full name after substitution is master,
96 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
106 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
113 Die with error code != 0 when a reference is undefined, instead of printing
119 Show uniquely abbreviated commit object as fallback\&.
123 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\&.
125 Enter \fIgit name\-rev\fR:
131 % git name\-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
132 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0\&.99~940
139 Now you are wiser, because you know that it happened 940 revisions before v0\&.99\&.
141 Another nice thing you can do is:
147 % git log | git name\-rev \-\-annotate\-stdin
155 Part of the \fBgit\fR(1) suite