blob: 5cb0eb0855fefe582721baeb3295beb610a74891 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-name-rev(1)
2===============
3
4NAME
5----
Junio C Hamano01078922006-03-10 00:31:476git-name-rev - Find symbolic names for given revs
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamanoa9b8d242007-05-19 04:51:5511[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3812'git name-rev' [--tags] [--refs=<pattern>]
Junio C Hamanoe6f28d02013-09-17 21:34:0013 ( --all | --stdin | <commit-ish>... )
Junio C Hamano1a4e8412005-12-27 08:17:2314
15DESCRIPTION
16-----------
17Finds symbolic names suitable for human digestion for revisions given in any
Junio C Hamano1aa40d22010-01-21 17:46:4318format parsable by 'git rev-parse'.
Junio C Hamano1a4e8412005-12-27 08:17:2319
20
21OPTIONS
22-------
23
24--tags::
25Do not use branch names, but only tags to name the commits
26
Junio C Hamano89d4e0f2007-02-18 00:34:5927--refs=<pattern>::
Junio C Hamanoa1952302013-07-01 21:31:1828Only use refs whose names match a given shell pattern. The pattern
Junio C Hamanocbe0eb22017-02-27 23:37:4929can 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.
32
33--exclude=<pattern>::
34Do not use any ref whose name matches a given shell pattern. The
35pattern can be one of branch name, tag name or fully qualified ref
36name. If given multiple times, a ref will be excluded when it matches
37any of the given patterns. When used together with --refs, a ref will
38be used as a match only when it matches at least one --refs pattern and
39does not match any --exclude patterns. Use `--no-exclude` to clear the
40list of exclude patterns.
Junio C Hamano89d4e0f2007-02-18 00:34:5941
Junio C Hamano1a4e8412005-12-27 08:17:2342--all::
43List all commits reachable from all refs
44
45--stdin::
Junio C Hamano8401f142013-07-12 22:47:4646Transform stdin by substituting all the 40-character SHA-1
47hexes (say $hex) with "$hex ($rev_name)". When used with
48--name-only, substitute with "$rev_name", omitting $hex
49altogether. Intended for the scripter's use.
Junio C Hamano1a4e8412005-12-27 08:17:2350
Junio C Hamano5e284b42007-05-22 07:23:3751--name-only::
52Instead of printing both the SHA-1 and the name, print only
53the name. If given with --tags the usual tag prefix of
Junio C Hamanoa6387422007-08-25 03:54:2754"tags/" is also omitted from the name, matching the output
Junio C Hamanoaf1987f2008-08-03 07:58:1955of `git-describe` more closely.
Junio C Hamano5e284b42007-05-22 07:23:3756
Junio C Hamanoeb415992008-06-08 22:49:4757--no-undefined::
58Die with error code != 0 when a reference is undefined,
59instead of printing `undefined`.
60
61--always::
62Show uniquely abbreviated commit object as fallback.
63
Junio C Hamanob9d9d902018-05-23 07:07:4264EXAMPLES
65--------
Junio C Hamano1a4e8412005-12-27 08:17:2366
67Given a commit, find out where it is relative to the local refs. Say somebody
Junio C Hamano7ccb9fd2006-07-15 01:38:4068wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
Junio C Hamano1a4e8412005-12-27 08:17:2369Of course, you look into the commit, but that only tells you what happened, but
70not the context.
71
Junio C Hamano1aa40d22010-01-21 17:46:4372Enter 'git name-rev':
Junio C Hamano1a4e8412005-12-27 08:17:2373
74------------
75% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
Junio C Hamanofcb740a2008-08-31 06:32:057633db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
Junio C Hamano1a4e8412005-12-27 08:17:2377------------
78
79Now you are wiser, because you know that it happened 940 revisions before v0.99.
80
81Another nice thing you can do is:
82
83------------
84% git log | git name-rev --stdin
85------------
86
Junio C Hamano1a4e8412005-12-27 08:17:2387GIT
88---
Junio C Hamanof7c042d2008-06-06 22:50:5389Part of the linkgit:git[1] suite