Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-name-rev(1) |
| 2 | =============== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 6 | git-name-rev - Find symbolic names for given revs |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | a9b8d24 | 2007-05-19 04:51:55 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 12 | 'git name-rev' [--tags] [--refs=<pattern>] |
Junio C Hamano | e6f28d0 | 2013-09-17 21:34:00 | [diff] [blame] | 13 | ( --all | --stdin | <commit-ish>... ) |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 14 | |
| 15 | DESCRIPTION |
| 16 | ----------- |
| 17 | Finds symbolic names suitable for human digestion for revisions given in any |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 18 | format parsable by 'git rev-parse'. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 19 | |
| 20 | |
| 21 | OPTIONS |
| 22 | ------- |
| 23 | |
| 24 | --tags:: |
| 25 | Do not use branch names, but only tags to name the commits |
| 26 | |
Junio C Hamano | 89d4e0f | 2007-02-18 00:34:59 | [diff] [blame] | 27 | --refs=<pattern>:: |
Junio C Hamano | a195230 | 2013-07-01 21:31:18 | [diff] [blame] | 28 | Only use refs whose names match a given shell pattern. The pattern |
Junio C Hamano | cbe0eb2 | 2017-02-27 23:37:49 | [diff] [blame] | 29 | can be one of branch name, tag name or fully qualified ref name. If |
| 30 | given multiple times, use refs whose names match any of the given shell |
| 31 | patterns. Use `--no-refs` to clear any previous ref patterns given. |
| 32 | |
| 33 | --exclude=<pattern>:: |
| 34 | Do not use any ref whose name matches a given shell pattern. The |
| 35 | pattern can be one of branch name, tag name or fully qualified ref |
| 36 | name. If given multiple times, a ref will be excluded when it matches |
| 37 | any of the given patterns. When used together with --refs, a ref will |
| 38 | be used as a match only when it matches at least one --refs pattern and |
| 39 | does not match any --exclude patterns. Use `--no-exclude` to clear the |
| 40 | list of exclude patterns. |
Junio C Hamano | 89d4e0f | 2007-02-18 00:34:59 | [diff] [blame] | 41 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 42 | --all:: |
| 43 | List all commits reachable from all refs |
| 44 | |
| 45 | --stdin:: |
Junio C Hamano | 8401f14 | 2013-07-12 22:47:46 | [diff] [blame] | 46 | Transform stdin by substituting all the 40-character SHA-1 |
| 47 | hexes (say $hex) with "$hex ($rev_name)". When used with |
| 48 | --name-only, substitute with "$rev_name", omitting $hex |
| 49 | altogether. Intended for the scripter's use. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 50 | |
Junio C Hamano | 5e284b4 | 2007-05-22 07:23:37 | [diff] [blame] | 51 | --name-only:: |
| 52 | Instead of printing both the SHA-1 and the name, print only |
| 53 | the name. If given with --tags the usual tag prefix of |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 54 | "tags/" is also omitted from the name, matching the output |
Junio C Hamano | af1987f | 2008-08-03 07:58:19 | [diff] [blame] | 55 | of `git-describe` more closely. |
Junio C Hamano | 5e284b4 | 2007-05-22 07:23:37 | [diff] [blame] | 56 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 57 | --no-undefined:: |
| 58 | Die with error code != 0 when a reference is undefined, |
| 59 | instead of printing `undefined`. |
| 60 | |
| 61 | --always:: |
| 62 | Show uniquely abbreviated commit object as fallback. |
| 63 | |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 64 | EXAMPLES |
| 65 | -------- |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 66 | |
| 67 | Given a commit, find out where it is relative to the local refs. Say somebody |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 68 | wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 69 | Of course, you look into the commit, but that only tells you what happened, but |
| 70 | not the context. |
| 71 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 72 | Enter 'git name-rev': |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 73 | |
| 74 | ------------ |
| 75 | % git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a |
Junio C Hamano | fcb740a | 2008-08-31 06:32:05 | [diff] [blame] | 76 | 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940 |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 77 | ------------ |
| 78 | |
| 79 | Now you are wiser, because you know that it happened 940 revisions before v0.99. |
| 80 | |
| 81 | Another nice thing you can do is: |
| 82 | |
| 83 | ------------ |
| 84 | % git log | git name-rev --stdin |
| 85 | ------------ |
| 86 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 87 | GIT |
| 88 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 89 | Part of the linkgit:git[1] suite |