1GIT-DESCRIBE(1)                   Git Manual                   GIT-DESCRIBE(1)
2
3
4

NAME

6       git-describe - Show the most recent tag that is reachable from a commit
7

SYNOPSIS

9       git-describe [--all] [--tags] [--contains] [--abbrev=<n>]
10       <committish>...
11

DESCRIPTION

13       The command finds the most recent tag that is reachable from a commit,
14       and if the commit itself is pointed at by the tag, shows the tag.
15       Otherwise, it suffixes the tag name with the number of additional
16       commits and the abbreviated object name of the commit.
17

OPTIONS

19       <committish>
20           The object name of the committish.
21
22       --all
23           Instead of using only the annotated tags, use any ref found in
24           .git/refs/.
25
26       --tags
27           Instead of using only the annotated tags, use any tag found in
28           .git/refs/tags.
29
30       --contains
31           Instead of finding the tag that predates the commit, find the tag
32           that comes after the commit, and thus contains it. Automatically
33           implies --tags.
34
35       --abbrev=<n>
36           Instead of using the default 8 hexadecimal digits as the
37           abbreviated object name, use <n> digits.
38
39       --candidates=<n>
40           Instead of considering only the 10 most recent tags as candidates
41           to describe the input committish consider up to <n> candidates.
42           Increasing <n> above 10 will take slightly longer but may produce a
43           more accurate result.
44
45       --debug
46           Verbosely display information about the searching strategy being
47           employed to standard error. The tag name will still be printed to
48           standard out.
49

EXAMPLES

51       With something like git.git current tree, I get:
52
53
54           [torvalds@g5 git]$ git-describe parent
55           v1.0.4-14-g2414721
56       i.e. the current head of my "parent" branch is based on v1.0.4, but
57       since it has a handful commits on top of that, describe has added the
58       number of additional commits ("14") and an abbreviated object name for
59       the commit itself ("2414721") at the end.
60
61       The number of additional commits is the number of commits which would
62       be displayed by "git log v1.0.4..parent". The hash suffix is "-g" +
63       7-char abbreviation for the tip commit of parent (which was
64       2414721b194453f058079d897d13c4e377f92dc6).
65
66       Doing a "git-describe" on a tag-name will just show the tag name:
67
68
69           [torvalds@g5 git]$ git-describe v1.0.4
70           v1.0.4
71       With --all, the command can use branch heads as references, so the
72       output shows the reference path as well:
73
74
75           [torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
76           tags/v1.0.0-21-g975b
77
78           [torvalds@g5 git]$ git describe --all HEAD^
79           heads/lt/describe-7-g975b
80       With --abbrev set to 0, the command can be used to find the closest
81       tagname without any suffix:
82
83
84           [torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
85           tags/v1.0.0
86

SEARCH STRATEGY

88       For each committish supplied "git describe" will first look for a tag
89       which tags exactly that commit. Annotated tags will always be preferred
90       over lightweight tags, and tags with newer dates will always be
91       preferred over tags with older dates. If an exact match is found, its
92       name will be output and searching will stop.
93
94       If an exact match was not found "git describe" will walk back through
95       the commit history to locate an ancestor commit which has been tagged.
96       The ancestor´s tag will be output along with an abbreviation of the
97       input committish´s SHA1.
98
99       If multiple tags were found during the walk then the tag which has the
100       fewest commits different from the input committish will be selected and
101       output. Here fewest commits different is defined as the number of
102       commits which would be shown by "git log tag..input" will be the
103       smallest number of commits possible.
104

AUTHOR

106       Written by Linus Torvalds <torvalds@osdl.org>, but somewhat butchered
107       by Junio C Hamano <junkio@cox.net>. Later significantly updated by
108       Shawn Pearce <spearce@spearce.org>.
109

DOCUMENTATION

111       Documentation by David Greaves, Junio C Hamano and the git-list
112       <git@vger.kernel.org>.
113

GIT

115       Part of the git(7) suite
116
117
118
119
120Git 1.5.3.3                       10/09/2007                   GIT-DESCRIBE(1)
Impressum