OSDN Git Service

Add Git official document to help
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / git-describe.html.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-describe(1)">\r
5 <articleinfo>\r
6     <title>git-describe(1)</title>\r
7         <indexterm>\r
8                 <primary>git-describe(1)</primary>\r
9         </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-describe - Show the most recent tag that is reachable from a commit</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <simpara><emphasis>git describe</emphasis> [--all] [--tags] [--contains] [--abbrev=&lt;n&gt;] &lt;committish&gt;&#8230;</simpara>\r
18 </simplesect>\r
19 <simplesect id="_description">\r
20 <title>DESCRIPTION</title>\r
21 <simpara>The command finds the most recent tag that is reachable from a\r
22 commit.  If the tag points to the commit, then only the tag is\r
23 shown.  Otherwise, it suffixes the tag name with the number of\r
24 additional commits on top of the tagged object and the\r
25 abbreviated object name of the most recent commit.</simpara>\r
26 <simpara>By default (without --all or --tags) <literal>git describe</literal> only shows\r
27 annotated tags.  For more information about creating annotated tags\r
28 see the -a and -s options to <xref linkend="git-tag(1)"/>.</simpara>\r
29 </simplesect>\r
30 <simplesect id="_options">\r
31 <title>OPTIONS</title>\r
32 <variablelist>\r
33 <varlistentry>\r
34 <term>\r
35 &lt;committish&gt;&#8230;\r
36 </term>\r
37 <listitem>\r
38 <simpara>\r
39         Committish object names to describe.\r
40 </simpara>\r
41 </listitem>\r
42 </varlistentry>\r
43 <varlistentry>\r
44 <term>\r
45 --all\r
46 </term>\r
47 <listitem>\r
48 <simpara>\r
49         Instead of using only the annotated tags, use any ref\r
50         found in <literal>.git/refs/</literal>.  This option enables matching\r
51         any known branch, remote branch, or lightweight tag.\r
52 </simpara>\r
53 </listitem>\r
54 </varlistentry>\r
55 <varlistentry>\r
56 <term>\r
57 --tags\r
58 </term>\r
59 <listitem>\r
60 <simpara>\r
61         Instead of using only the annotated tags, use any tag\r
62         found in <literal>.git/refs/tags</literal>.  This option enables matching\r
63         a lightweight (non-annotated) tag.\r
64 </simpara>\r
65 </listitem>\r
66 </varlistentry>\r
67 <varlistentry>\r
68 <term>\r
69 --contains\r
70 </term>\r
71 <listitem>\r
72 <simpara>\r
73         Instead of finding the tag that predates the commit, find\r
74         the tag that comes after the commit, and thus contains it.\r
75         Automatically implies --tags.\r
76 </simpara>\r
77 </listitem>\r
78 </varlistentry>\r
79 <varlistentry>\r
80 <term>\r
81 --abbrev=&lt;n&gt;\r
82 </term>\r
83 <listitem>\r
84 <simpara>\r
85         Instead of using the default 7 hexadecimal digits as the\r
86         abbreviated object name, use &lt;n&gt; digits.\r
87 </simpara>\r
88 </listitem>\r
89 </varlistentry>\r
90 <varlistentry>\r
91 <term>\r
92 --candidates=&lt;n&gt;\r
93 </term>\r
94 <listitem>\r
95 <simpara>\r
96         Instead of considering only the 10 most recent tags as\r
97         candidates to describe the input committish consider\r
98         up to &lt;n&gt; candidates.  Increasing &lt;n&gt; above 10 will take\r
99         slightly longer but may produce a more accurate result.\r
100         An &lt;n&gt; of 0 will cause only exact matches to be output.\r
101 </simpara>\r
102 </listitem>\r
103 </varlistentry>\r
104 <varlistentry>\r
105 <term>\r
106 --exact-match\r
107 </term>\r
108 <listitem>\r
109 <simpara>\r
110         Only output exact matches (a tag directly references the\r
111         supplied commit).  This is a synonym for --candidates=0.\r
112 </simpara>\r
113 </listitem>\r
114 </varlistentry>\r
115 <varlistentry>\r
116 <term>\r
117 --debug\r
118 </term>\r
119 <listitem>\r
120 <simpara>\r
121         Verbosely display information about the searching strategy\r
122         being employed to standard error.  The tag name will still\r
123         be printed to standard out.\r
124 </simpara>\r
125 </listitem>\r
126 </varlistentry>\r
127 <varlistentry>\r
128 <term>\r
129 --long\r
130 </term>\r
131 <listitem>\r
132 <simpara>\r
133         Always output the long format (the tag, the number of commits\r
134         and the abbreviated commit name) even when it matches a tag.\r
135         This is useful when you want to see parts of the commit object name\r
136         in "describe" output, even when the commit in question happens to be\r
137         a tagged version.  Instead of just emitting the tag name, it will\r
138         describe such a commit as v1.2-0-deadbeef (0th commit since tag v1.2\r
139         that points at object deadbeef&#8230;.).\r
140 </simpara>\r
141 </listitem>\r
142 </varlistentry>\r
143 <varlistentry>\r
144 <term>\r
145 --match &lt;pattern&gt;\r
146 </term>\r
147 <listitem>\r
148 <simpara>\r
149         Only consider tags matching the given pattern (can be used to avoid\r
150         leaking private tags made from the repository).\r
151 </simpara>\r
152 </listitem>\r
153 </varlistentry>\r
154 <varlistentry>\r
155 <term>\r
156 --always\r
157 </term>\r
158 <listitem>\r
159 <simpara>\r
160         Show uniquely abbreviated commit object as fallback.\r
161 </simpara>\r
162 </listitem>\r
163 </varlistentry>\r
164 </variablelist>\r
165 </simplesect>\r
166 <simplesect id="_examples">\r
167 <title>EXAMPLES</title>\r
168 <simpara>With something like git.git current tree, I get:</simpara>\r
169 <literallayout class="monospaced">[torvalds@g5 git]$ git describe parent\r
170 v1.0.4-14-g2414721</literallayout>\r
171 <simpara>i.e. the current head of my "parent" branch is based on v1.0.4,\r
172 but since it has a few commits on top of that,\r
173 describe has added the number of additional commits ("14") and\r
174 an abbreviated object name for the commit itself ("2414721")\r
175 at the end.</simpara>\r
176 <simpara>The number of additional commits is the number\r
177 of commits which would be displayed by "git log v1.0.4..parent".\r
178 The hash suffix is "-g" + 7-char abbreviation for the tip commit\r
179 of parent (which was <literal>2414721b194453f058079d897d13c4e377f92dc6</literal>).</simpara>\r
180 <simpara>Doing a <emphasis>git-describe</emphasis> on a tag-name will just show the tag name:</simpara>\r
181 <literallayout class="monospaced">[torvalds@g5 git]$ git describe v1.0.4\r
182 v1.0.4</literallayout>\r
183 <simpara>With --all, the command can use branch heads as references, so\r
184 the output shows the reference path as well:</simpara>\r
185 <literallayout class="monospaced">[torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2\r
186 tags/v1.0.0-21-g975b</literallayout>\r
187 <literallayout class="monospaced">[torvalds@g5 git]$ git describe --all HEAD^\r
188 heads/lt/describe-7-g975b</literallayout>\r
189 <simpara>With --abbrev set to 0, the command can be used to find the\r
190 closest tagname without any suffix:</simpara>\r
191 <literallayout class="monospaced">[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2\r
192 tags/v1.0.0</literallayout>\r
193 </simplesect>\r
194 <simplesect id="_search_strategy">\r
195 <title>SEARCH STRATEGY</title>\r
196 <simpara>For each committish supplied, <emphasis>git-describe</emphasis> will first look for\r
197 a tag which tags exactly that commit.  Annotated tags will always\r
198 be preferred over lightweight tags, and tags with newer dates will\r
199 always be preferred over tags with older dates.  If an exact match\r
200 is found, its name will be output and searching will stop.</simpara>\r
201 <simpara>If an exact match was not found, <emphasis>git-describe</emphasis> will walk back\r
202 through the commit history to locate an ancestor commit which\r
203 has been tagged.  The ancestor&#8217;s tag will be output along with an\r
204 abbreviation of the input committish&#8217;s SHA1.</simpara>\r
205 <simpara>If multiple tags were found during the walk then the tag which\r
206 has the fewest commits different from the input committish will be\r
207 selected and output.  Here fewest commits different is defined as\r
208 the number of commits which would be shown by <literal>git log tag..input</literal>\r
209 will be the smallest number of commits possible.</simpara>\r
210 </simplesect>\r
211 <simplesect id="_author">\r
212 <title>Author</title>\r
213 <simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;, but somewhat\r
214 butchered by Junio C Hamano &lt;<ulink url="mailto:gitster@pobox.com">gitster@pobox.com</ulink>&gt;.  Later significantly\r
215 updated by Shawn Pearce &lt;<ulink url="mailto:spearce@spearce.org">spearce@spearce.org</ulink>&gt;.</simpara>\r
216 </simplesect>\r
217 <simplesect id="_documentation">\r
218 <title>Documentation</title>\r
219 <simpara>Documentation by David Greaves, Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
220 </simplesect>\r
221 <simplesect id="_git">\r
222 <title>GIT</title>\r
223 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
224 </simplesect>\r
225 </article>\r