]>
Commit | Line | Data |
---|---|---|
c06818e2 JH |
1 | git-describe(1) |
2 | =============== | |
3 | ||
4 | NAME | |
5 | ---- | |
7bd7f280 | 6 | git-describe - Show the most recent tag that is reachable from a commit |
c06818e2 JH |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
11 | 'git-describe' [--all] [--tags] [--abbrev=<n>] <committish>... | |
12 | ||
13 | DESCRIPTION | |
14 | ----------- | |
15 | The command finds the most recent tag that is reachable from a | |
16 | commit, and if the commit itself is pointed at by the tag, shows | |
17 | the tag. Otherwise, it suffixes the tag name with abbreviated | |
18 | object name of the commit. | |
19 | ||
20 | ||
21 | OPTIONS | |
22 | ------- | |
23 | <committish>:: | |
37425065 | 24 | The object name of the committish. |
c06818e2 JH |
25 | |
26 | --all:: | |
27 | Instead of using only the annotated tags, use any ref | |
28 | found in `.git/refs/`. | |
29 | ||
30 | --tags:: | |
31 | Instead of using only the annotated tags, use any tag | |
32 | found in `.git/refs/tags`. | |
33 | ||
34 | --abbrev=<n>:: | |
35 | Instead of using the default 8 hexadecimal digits as the | |
36 | abbreviated object name, use <n> digits. | |
37 | ||
8713ab30 SP |
38 | --candidates=<n>:: |
39 | Instead of considering only the 10 most recent tags as | |
40 | candidates to describe the input committish consider | |
41 | up to <n> candidates. Increasing <n> above 10 will take | |
42 | slightly longer but may produce a more accurate result. | |
43 | ||
44 | --debug:: | |
45 | Verbosely display information about the searching strategy | |
46 | being employed to standard error. The tag name will still | |
47 | be printed to standard out. | |
c06818e2 JH |
48 | |
49 | EXAMPLES | |
50 | -------- | |
51 | ||
52 | With something like git.git current tree, I get: | |
53 | ||
54 | [torvalds@g5 git]$ git-describe parent | |
55 | v1.0.4-g2414721b | |
56 | ||
57 | i.e. the current head of my "parent" branch is based on v1.0.4, | |
58 | but since it has a few commits on top of that, it has added the | |
59 | git hash of the thing to the end: "-g" + 8-char shorthand for | |
60 | the commit `2414721b194453f058079d897d13c4e377f92dc6`. | |
61 | ||
62 | Doing a "git-describe" on a tag-name will just show the tag name: | |
63 | ||
64 | [torvalds@g5 git]$ git-describe v1.0.4 | |
65 | v1.0.4 | |
66 | ||
67 | With --all, the command can use branch heads as references, so | |
68 | the output shows the reference path as well: | |
69 | ||
70 | [torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2 | |
71 | tags/v1.0.0-g975b | |
72 | ||
73 | [torvalds@g5 git]$ git describe --all HEAD^ | |
74 | heads/lt/describe-g975b | |
75 | ||
8713ab30 SP |
76 | SEARCH STRATEGY |
77 | --------------- | |
78 | ||
79 | For each committish supplied "git describe" will first look for | |
80 | a tag which tags exactly that commit. Annotated tags will always | |
81 | be preferred over lightweight tags, and tags with newer dates will | |
82 | always be preferred over tags with older dates. If an exact match | |
83 | is found, its name will be output and searching will stop. | |
84 | ||
85 | If an exact match was not found "git describe" will walk back | |
86 | through the commit history to locate an ancestor commit which | |
87 | has been tagged. The ancestor's tag will be output along with an | |
88 | abbreviation of the input committish's SHA1. | |
89 | ||
90 | If multiple tags were found during the walk then the tag which | |
91 | has the fewest commits different from the input committish will be | |
92 | selected and output. Here fewest commits different is defined as | |
93 | the number of commits which would be shown by "git log tag..input" | |
94 | will be the smallest number of commits possible. | |
95 | ||
c06818e2 JH |
96 | |
97 | Author | |
98 | ------ | |
99 | Written by Linus Torvalds <torvalds@osdl.org>, but somewhat | |
100 | butchered by Junio C Hamano <junkio@cox.net> | |
101 | ||
102 | Documentation | |
103 | -------------- | |
104 | Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. | |
105 | ||
106 | GIT | |
107 | --- | |
108 | Part of the gitlink:git[7] suite | |
109 |