1git-name-rev(1)
2===============
34
NAME
5----
6git-name-rev - Find symbolic names for given revs
78
9
SYNOPSIS
10--------
11[verse]
12'git name-rev' [--tags] [--refs=<pattern>]
13( --all | --stdin | <commit-ish>... )
1415
DESCRIPTION
16-----------
17Finds symbolic names suitable for human digestion for revisions given in any
18format parsable by 'git rev-parse'.
1920
21
OPTIONS
22-------
2324
--tags::
25Do not use branch names, but only tags to name the commits
2627
--refs=<pattern>::
28Only use refs whose names match a given shell pattern. The pattern
29can be one of branch name, tag name or fully qualified ref name. If
30given multiple times, use refs whose names match any of the given shell
31patterns. Use `--no-refs` to clear any previous ref patterns given.
3233
--all::
34List all commits reachable from all refs
3536
--stdin::
37Transform stdin by substituting all the 40-character SHA-1
38hexes (say $hex) with "$hex ($rev_name)". When used with
39--name-only, substitute with "$rev_name", omitting $hex
40altogether. Intended for the scripter's use.
4142
--name-only::
43Instead of printing both the SHA-1 and the name, print only
44the name. If given with --tags the usual tag prefix of
45"tags/" is also omitted from the name, matching the output
46of `git-describe` more closely.
4748
--no-undefined::
49Die with error code != 0 when a reference is undefined,
50instead of printing `undefined`.
5152
--always::
53Show uniquely abbreviated commit object as fallback.
5455
EXAMPLE
56-------
5758
Given a commit, find out where it is relative to the local refs. Say somebody
59wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
60Of course, you look into the commit, but that only tells you what happened, but
61not the context.
6263
Enter 'git name-rev':
6465
------------
66% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
6733db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
68------------
6970
Now you are wiser, because you know that it happened 940 revisions before v0.99.
7172
Another nice thing you can do is:
7374
------------
75% git log | git name-rev --stdin
76------------
7778
GIT
79---
80Part of the linkgit:git[1] suite