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
13 Finds symbolic names suitable for human digestion for revisions given
14 in any format parsable by git rev-parse.
15
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 --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. Intended for
43 the scripter’s use.
44
45 --name-only
46 Instead of printing both the SHA-1 and the name, print only the
47 name. If given with --tags the usual tag prefix of "tags/" is also
48 omitted from the name, matching the output of git-describe more
49 closely.
50
51 --no-undefined
52 Die with error code != 0 when a reference is undefined, instead of
53 printing undefined.
54
55 --always
56 Show uniquely abbreviated commit object as fallback.
57
59 Given a commit, find out where it is relative to the local refs. Say
60 somebody wrote you about that fantastic commit
61 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the
62 commit, but that only tells you what happened, but not the context.
63
64 Enter git name-rev:
65
66 % git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
67 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
68
69 Now you are wiser, because you know that it happened 940 revisions
70 before v0.99.
71
72 Another nice thing you can do is:
73
74 % git log | git name-rev --stdin
75
77 Part of the git(1) suite
78
79
80
81Git 2.33.1 2021-10-12 GIT-NAME-REV(1)