More precise description of 'git describe --abbrev'
Also adds a note about why the output in the examples might give different output today. Signed-off-by: Gisle Aas <gisle@aas.no> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Gisle Aas committed
Oct 29, 2009 at 22:29 UTC
492cf3f72f9d8a0308cc42a9ffc00ef782c88a20
1 file changed
+13
-4
Documentation/git-describe.txt
+13
-4
@@ -44,7 +44,9 @@ OPTIONS
44
45
--abbrev=<n>::
46
Instead of using the default 7 hexadecimal digits as the
47
- abbreviated object name, use <n> digits.
47
+ abbreviated object name, use <n> digits, or as many digits
48
+ as needed to form a unique object name. An <n> of 0
49
+ will suppress long format, only showing the closest tag.
50
51
--candidates=<n>::
52
Instead of considering only the 10 most recent tags as
@@ -68,8 +70,8 @@ OPTIONS
70
This is useful when you want to see parts of the commit object name
71
in "describe" output, even when the commit in question happens to be
72
a tagged version. Instead of just emitting the tag name, it will
71
- describe such a commit as v1.2-0-deadbeef (0th commit since tag v1.2
72
- that points at object deadbeef....).
73
+ describe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2
74
+ that points at object deadbee....).
75
76
--match <pattern>::
77
Only consider tags matching the given pattern (can be used to avoid
@@ -108,7 +110,7 @@ the output shows the reference path as well:
110
[torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
111
tags/v1.0.0-21-g975b
112
111
- [torvalds@g5 git]$ git describe --all HEAD^
113
+ [torvalds@g5 git]$ git describe --all --abbrev=4 HEAD^
114
heads/lt/describe-7-g975b
115
116
With --abbrev set to 0, the command can be used to find the
@@ -117,6 +119,13 @@ closest tagname without any suffix:
119
[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
120
tags/v1.0.0
121
122
+Note that the suffix you get if you type these commands today may be
123
+longer than what Linus saw above when he ran this command, as your
124
+git repository may have new commits whose object names begin with
125
+975b that did not exist back then, and "-g975b" suffix alone may not
126
+be sufficient to disambiguate these commits.
127
+
128
+
129
SEARCH STRATEGY
130
---------------
131