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.
3031
--all::
32List all commits reachable from all refs
3334
--stdin::
35Transform stdin by substituting all the 40-character SHA-1
36hexes (say $hex) with "$hex ($rev_name)". When used with
37--name-only, substitute with "$rev_name", omitting $hex
38altogether. Intended for the scripter's use.
3940
--name-only::
41Instead of printing both the SHA-1 and the name, print only
42the name. If given with --tags the usual tag prefix of
43"tags/" is also omitted from the name, matching the output
44of `git-describe` more closely.
4546
--no-undefined::
47Die with error code != 0 when a reference is undefined,
48instead of printing `undefined`.
4950
--always::
51Show uniquely abbreviated commit object as fallback.
5253
EXAMPLE
54-------
5556
Given a commit, find out where it is relative to the local refs. Say somebody
57wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
58Of course, you look into the commit, but that only tells you what happened, but
59not the context.
6061
Enter 'git name-rev':
6263
------------
64% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
6533db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
66------------
6768
Now you are wiser, because you know that it happened 940 revisions before v0.99.
6970
Another nice thing you can do is:
7172
------------
73% git log | git name-rev --stdin
74------------
7576
GIT
77---
78Part of the linkgit:git[1] suite