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