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 |
| 29 | can be one of branch name, tag name or fully qualified ref name. |
Junio C Hamano | 89d4e0f | 2007-02-18 00:34:59 | [diff] [blame] | 30 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 31 | --all:: |
| 32 | List all commits reachable from all refs |
| 33 | |
| 34 | --stdin:: |
Junio C Hamano | 8401f14 | 2013-07-12 22:47:46 | [diff] [blame] | 35 | Transform stdin by substituting all the 40-character SHA-1 |
| 36 | hexes (say $hex) with "$hex ($rev_name)". When used with |
| 37 | --name-only, substitute with "$rev_name", omitting $hex |
| 38 | altogether. Intended for the scripter's use. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 39 | |
Junio C Hamano | 5e284b4 | 2007-05-22 07:23:37 | [diff] [blame] | 40 | --name-only:: |
| 41 | Instead of printing both the SHA-1 and the name, print only |
| 42 | the name. If given with --tags the usual tag prefix of |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 43 | "tags/" is also omitted from the name, matching the output |
Junio C Hamano | af1987f | 2008-08-03 07:58:19 | [diff] [blame] | 44 | of `git-describe` more closely. |
Junio C Hamano | 5e284b4 | 2007-05-22 07:23:37 | [diff] [blame] | 45 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 46 | --no-undefined:: |
| 47 | Die with error code != 0 when a reference is undefined, |
| 48 | instead of printing `undefined`. |
| 49 | |
| 50 | --always:: |
| 51 | Show uniquely abbreviated commit object as fallback. |
| 52 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 53 | EXAMPLE |
| 54 | ------- |
| 55 | |
| 56 | 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] | 57 | wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 58 | Of course, you look into the commit, but that only tells you what happened, but |
| 59 | not the context. |
| 60 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 61 | Enter 'git name-rev': |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 62 | |
| 63 | ------------ |
| 64 | % git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a |
Junio C Hamano | fcb740a | 2008-08-31 06:32:05 | [diff] [blame] | 65 | 33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940 |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 66 | ------------ |
| 67 | |
| 68 | Now you are wiser, because you know that it happened 940 revisions before v0.99. |
| 69 | |
| 70 | Another nice thing you can do is: |
| 71 | |
| 72 | ------------ |
| 73 | % git log | git name-rev --stdin |
| 74 | ------------ |
| 75 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 76 | GIT |
| 77 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 78 | Part of the linkgit:git[1] suite |