2 .\" Title: git-name-rev
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
7 .\" Source: Git 2.47.0.rc0
10 .TH "GIT\-NAME\-REV" "1" "2024-09-25" "Git 2\&.47\&.0\&.rc0" "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>\&...\: )
40 Finds symbolic names suitable for human digestion for revisions given in any format parsable by \fIgit rev\-parse\fR\&.
45 Do not use branch names, but only tags to name the commits
50 Only use refs whose names match a given shell pattern\&. The pattern can be a branch name, a tag name, or a fully qualified ref name\&. If given multiple times, use refs whose names match any of the given shell patterns\&. Use
52 to clear any previous ref patterns given\&.
57 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
59 to clear the list of exclude patterns\&.
64 List all commits reachable from all refs
69 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
71 in older versions of Git\&.
81 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
82 The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907,
83 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
85 $ git name\-rev \-\-annotate\-stdin <sample\&.txt
87 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
88 The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907 (master),
89 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
91 $ git name\-rev \-\-name\-only \-\-annotate\-stdin <sample\&.txt
93 An abbreviated revision 2ae0a9cb82 will not be substituted\&.
94 The full name after substitution is master,
95 while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
104 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
111 Die with error code != 0 when a reference is undefined, instead of printing
117 Show uniquely abbreviated commit object as fallback\&.
121 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\&.
123 Enter \fIgit name\-rev\fR:
129 % git name\-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
130 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0\&.99~940
136 Now you are wiser, because you know that it happened 940 revisions before v0\&.99\&.
138 Another nice thing you can do is:
144 % git log | git name\-rev \-\-annotate\-stdin
151 Part of the \fBgit\fR(1) suite