1GIT-NAME-REV(1) Git Manual GIT-NAME-REV(1)
2
3
4
6 git-name-rev - Find symbolic names for given revs
7
9 git name-rev [--tags] [--refs=<pattern>]
10 ( --all | --stdin | <commit-ish>... )
11
12
14 Finds symbolic names suitable for human digestion for revisions given
15 in any format parsable by git rev-parse.
16
18 --tags
19 Do not use branch names, but only tags to name the commits
20
21 --refs=<pattern>
22 Only use refs whose names match a given shell pattern. The pattern
23 can be one of branch name, tag name or fully qualified ref name. If
24 given multiple times, use refs whose names match any of the given
25 shell patterns. Use --no-refs to clear any previous ref patterns
26 given.
27
28 --exclude=<pattern>
29 Do not use any ref whose name matches a given shell pattern. The
30 pattern can be one of branch name, tag name or fully qualified ref
31 name. If given multiple times, a ref will be excluded when it
32 matches any of the given patterns. When used together with --refs,
33 a ref will be used as a match only when it matches at least one
34 --refs pattern and does not match any --exclude patterns. Use
35 --no-exclude to clear the list of exclude patterns.
36
37 --all
38 List all commits reachable from all refs
39
40 --stdin
41 Transform stdin by substituting all the 40-character SHA-1 hexes
42 (say $hex) with "$hex ($rev_name)". When used with --name-only,
43 substitute with "$rev_name", omitting $hex altogether. Intended for
44 the scripter’s use.
45
46 --name-only
47 Instead of printing both the SHA-1 and the name, print only the
48 name. If given with --tags the usual tag prefix of "tags/" is also
49 omitted from the name, matching the output of git-describe more
50 closely.
51
52 --no-undefined
53 Die with error code != 0 when a reference is undefined, instead of
54 printing undefined.
55
56 --always
57 Show uniquely abbreviated commit object as fallback.
58
60 Given a commit, find out where it is relative to the local refs. Say
61 somebody wrote you about that fantastic commit
62 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the
63 commit, but that only tells you what happened, but not the context.
64
65 Enter git name-rev:
66
67 % git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
68 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
69
70
71 Now you are wiser, because you know that it happened 940 revisions
72 before v0.99.
73
74 Another nice thing you can do is:
75
76 % git log | git name-rev --stdin
77
78
80 Part of the git(1) suite
81
82
83
84Git 2.18.1 05/14/2019 GIT-NAME-REV(1)