1GIT-NAME-REV(1)                   Git Manual                   GIT-NAME-REV(1)
2
3
4

NAME

6       git-name-rev - Find symbolic names for given revs
7

SYNOPSIS

9       git name-rev [--tags] [--refs=<pattern>]
10                      ( --all | --stdin | <commit-ish>... )
11

DESCRIPTION

13       Finds symbolic names suitable for human digestion for revisions given
14       in any format parsable by git rev-parse.
15

OPTIONS

17       --tags
18           Do not use branch names, but only tags to name the commits
19
20       --refs=<pattern>
21           Only use refs whose names match a given shell pattern. The pattern
22           can be one of branch name, tag name or fully qualified ref name. If
23           given multiple times, use refs whose names match any of the given
24           shell patterns. Use --no-refs to clear any previous ref patterns
25           given.
26
27       --exclude=<pattern>
28           Do not use any ref whose name matches a given shell pattern. The
29           pattern can be one of branch name, tag name or fully qualified ref
30           name. If given multiple times, a ref will be excluded when it
31           matches any of the given patterns. When used together with --refs,
32           a ref will be used as a match only when it matches at least one
33           --refs pattern and does not match any --exclude patterns. Use
34           --no-exclude to clear the list of exclude patterns.
35
36       --all
37           List all commits reachable from all refs
38
39       --annotate-stdin
40           Transform stdin by substituting all the 40-character SHA-1 hexes
41           (say $hex) with "$hex ($rev_name)". When used with --name-only,
42           substitute with "$rev_name", omitting $hex altogether.
43
44           For example:
45
46               $ cat sample.txt
47
48               An abbreviated revision 2ae0a9cb82 will not be substituted.
49               The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907,
50               while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
51
52               $ git name-rev --annotate-stdin <sample.txt
53
54               An abbreviated revision 2ae0a9cb82 will not be substituted.
55               The full name after substitution is 2ae0a9cb8298185a94e5998086f380a355dd8907 (master),
56               while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
57
58               $ git name-rev --name-only --annotate-stdin <sample.txt
59
60               An abbreviated revision 2ae0a9cb82 will not be substituted.
61               The full name after substitution is master,
62               while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
63
64       --stdin
65           This option is deprecated in favor of git name-rev
66           --annotate-stdin. They are functionally equivalent.
67
68       --name-only
69           Instead of printing both the SHA-1 and the name, print only the
70           name. If given with --tags the usual tag prefix of "tags/" is also
71           omitted from the name, matching the output of git-describe more
72           closely.
73
74       --no-undefined
75           Die with error code != 0 when a reference is undefined, instead of
76           printing undefined.
77
78       --always
79           Show uniquely abbreviated commit object as fallback.
80

EXAMPLES

82       Given a commit, find out where it is relative to the local refs. Say
83       somebody wrote you about that fantastic commit
84       33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the
85       commit, but that only tells you what happened, but not the context.
86
87       Enter git name-rev:
88
89           % git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
90           33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
91
92       Now you are wiser, because you know that it happened 940 revisions
93       before v0.99.
94
95       Another nice thing you can do is:
96
97           % git log | git name-rev --stdin
98

GIT

100       Part of the git(1) suite
101
102
103
104Git 2.39.1                        2023-01-13                   GIT-NAME-REV(1)
Impressum