updated git doc
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-tag.xml
blobc84d390a8100e3c00b61e9fbc8926b71d00e08f9
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-tag(1)">\r
5 <articleinfo>\r
6     <title>git-tag(1)</title>\r
7 <indexterm>\r
8 <primary>git-tag(1)</primary>\r
9 </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-tag - Create, list, delete or verify a tag object signed with GPG</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>git tag</emphasis> [-a | -s | -u &lt;key-id&gt;] [-f] [-m &lt;msg&gt; | -F &lt;file&gt;]\r
19         &lt;tagname&gt; [&lt;commit&gt; | &lt;object&gt;]\r
20 <emphasis>git tag</emphasis> -d &lt;tagname&gt;&#8230;\r
21 <emphasis>git tag</emphasis> [-n[&lt;num&gt;]] -l [--contains &lt;commit&gt;] [--points-at &lt;object&gt;]\r
22         [&lt;pattern&gt;&#8230;]\r
23 <emphasis>git tag</emphasis> -v &lt;tagname&gt;&#8230;</literallayout>\r
24 </blockquote>\r
25 </simplesect>\r
26 <simplesect id="_description">\r
27 <title>DESCRIPTION</title>\r
28 <simpara>Add a tag reference in <emphasis>.git/refs/tags/</emphasis>, unless <emphasis>-d/-l/-v</emphasis> is given\r
29 to delete, list or verify tags.</simpara>\r
30 <simpara>Unless <emphasis>-f</emphasis> is given, the tag to be created must not yet exist in the\r
31 <emphasis>.git/refs/tags/</emphasis> directory.</simpara>\r
32 <simpara>If one of <emphasis>-a</emphasis>, <emphasis>-s</emphasis>, or <emphasis>-u &lt;key-id&gt;</emphasis> is passed, the command\r
33 creates a <emphasis>tag</emphasis> object, and requires a tag message.  Unless\r
34 <emphasis>-m &lt;msg&gt;</emphasis> or <emphasis>-F &lt;file&gt;</emphasis> is given, an editor is started for the user to type\r
35 in the tag message.</simpara>\r
36 <simpara>If <emphasis>-m &lt;msg&gt;</emphasis> or <emphasis>-F &lt;file&gt;</emphasis> is given and <emphasis>-a</emphasis>, <emphasis>-s</emphasis>, and <emphasis>-u &lt;key-id&gt;</emphasis>\r
37 are absent, <emphasis>-a</emphasis> is implied.</simpara>\r
38 <simpara>Otherwise just a tag reference for the SHA1 object name of the commit object is\r
39 created (i.e. a lightweight tag).</simpara>\r
40 <simpara>A GnuPG signed tag object will be created when <emphasis>-s</emphasis> or <emphasis>-u\r
41 &lt;key-id&gt;</emphasis> is used.  When <emphasis>-u &lt;key-id&gt;</emphasis> is not used, the\r
42 committer identity for the current user is used to find the\r
43 GnuPG key for signing.  The configuration variable <emphasis>gpg.program</emphasis>\r
44 is used to specify custom GnuPG binary.</simpara>\r
45 </simplesect>\r
46 <simplesect id="_options">\r
47 <title>OPTIONS</title>\r
48 <variablelist>\r
49 <varlistentry>\r
50 <term>\r
51 -a\r
52 </term>\r
53 <term>\r
54 --annotate\r
55 </term>\r
56 <listitem>\r
57 <simpara>\r
58         Make an unsigned, annotated tag object\r
59 </simpara>\r
60 </listitem>\r
61 </varlistentry>\r
62 <varlistentry>\r
63 <term>\r
64 -s\r
65 </term>\r
66 <term>\r
67 --sign\r
68 </term>\r
69 <listitem>\r
70 <simpara>\r
71         Make a GPG-signed tag, using the default e-mail address's key.\r
72 </simpara>\r
73 </listitem>\r
74 </varlistentry>\r
75 <varlistentry>\r
76 <term>\r
77 -u &lt;key-id&gt;\r
78 </term>\r
79 <term>\r
80 --local-user=&lt;key-id&gt;\r
81 </term>\r
82 <listitem>\r
83 <simpara>\r
84         Make a GPG-signed tag, using the given key.\r
85 </simpara>\r
86 </listitem>\r
87 </varlistentry>\r
88 <varlistentry>\r
89 <term>\r
90 -f\r
91 </term>\r
92 <term>\r
93 --force\r
94 </term>\r
95 <listitem>\r
96 <simpara>\r
97         Replace an existing tag with the given name (instead of failing)\r
98 </simpara>\r
99 </listitem>\r
100 </varlistentry>\r
101 <varlistentry>\r
102 <term>\r
103 -d\r
104 </term>\r
105 <term>\r
106 --delete\r
107 </term>\r
108 <listitem>\r
109 <simpara>\r
110         Delete existing tags with the given names.\r
111 </simpara>\r
112 </listitem>\r
113 </varlistentry>\r
114 <varlistentry>\r
115 <term>\r
116 -v\r
117 </term>\r
118 <term>\r
119 --verify\r
120 </term>\r
121 <listitem>\r
122 <simpara>\r
123         Verify the gpg signature of the given tag names.\r
124 </simpara>\r
125 </listitem>\r
126 </varlistentry>\r
127 <varlistentry>\r
128 <term>\r
129 -n&lt;num&gt;\r
130 </term>\r
131 <listitem>\r
132 <simpara>\r
133         &lt;num&gt; specifies how many lines from the annotation, if any,\r
134         are printed when using -l.\r
135         The default is not to print any annotation lines.\r
136         If no number is given to <emphasis>-n</emphasis>, only the first line is printed.\r
137         If the tag is not annotated, the commit message is displayed instead.\r
138 </simpara>\r
139 </listitem>\r
140 </varlistentry>\r
141 <varlistentry>\r
142 <term>\r
143 -l &lt;pattern&gt;\r
144 </term>\r
145 <term>\r
146 --list &lt;pattern&gt;\r
147 </term>\r
148 <listitem>\r
149 <simpara>\r
150         List tags with names that match the given pattern (or all if no\r
151         pattern is given).  Running "git tag" without arguments also\r
152         lists all tags. The pattern is a shell wildcard (i.e., matched\r
153         using fnmatch(3)).  Multiple patterns may be given; if any of\r
154         them matches, the tag is shown.\r
155 </simpara>\r
156 </listitem>\r
157 </varlistentry>\r
158 <varlistentry>\r
159 <term>\r
160 --contains &lt;commit&gt;\r
161 </term>\r
162 <listitem>\r
163 <simpara>\r
164         Only list tags which contain the specified commit.\r
165 </simpara>\r
166 </listitem>\r
167 </varlistentry>\r
168 <varlistentry>\r
169 <term>\r
170 --points-at &lt;object&gt;\r
171 </term>\r
172 <listitem>\r
173 <simpara>\r
174         Only list tags of the given object.\r
175 </simpara>\r
176 </listitem>\r
177 </varlistentry>\r
178 <varlistentry>\r
179 <term>\r
180 -m &lt;msg&gt;\r
181 </term>\r
182 <term>\r
183 --message=&lt;msg&gt;\r
184 </term>\r
185 <listitem>\r
186 <simpara>\r
187         Use the given tag message (instead of prompting).\r
188         If multiple <emphasis>-m</emphasis> options are given, their values are\r
189         concatenated as separate paragraphs.\r
190         Implies <emphasis>-a</emphasis> if none of <emphasis>-a</emphasis>, <emphasis>-s</emphasis>, or <emphasis>-u &lt;key-id&gt;</emphasis>\r
191         is given.\r
192 </simpara>\r
193 </listitem>\r
194 </varlistentry>\r
195 <varlistentry>\r
196 <term>\r
197 -F &lt;file&gt;\r
198 </term>\r
199 <term>\r
200 --file=&lt;file&gt;\r
201 </term>\r
202 <listitem>\r
203 <simpara>\r
204         Take the tag message from the given file.  Use <emphasis>-</emphasis> to\r
205         read the message from the standard input.\r
206         Implies <emphasis>-a</emphasis> if none of <emphasis>-a</emphasis>, <emphasis>-s</emphasis>, or <emphasis>-u &lt;key-id&gt;</emphasis>\r
207         is given.\r
208 </simpara>\r
209 </listitem>\r
210 </varlistentry>\r
211 <varlistentry>\r
212 <term>\r
213 --cleanup=&lt;mode&gt;\r
214 </term>\r
215 <listitem>\r
216 <simpara>\r
217         This option sets how the tag message is cleaned up.\r
218         The  <emphasis>&lt;mode&gt;</emphasis> can be one of <emphasis>verbatim</emphasis>, <emphasis>whitespace</emphasis> and <emphasis>strip</emphasis>.  The\r
219         <emphasis>strip</emphasis> mode is default. The <emphasis>verbatim</emphasis> mode does not change message at\r
220         all, <emphasis>whitespace</emphasis> removes just leading/trailing whitespace lines and\r
221         <emphasis>strip</emphasis> removes both whitespace and commentary.\r
222 </simpara>\r
223 </listitem>\r
224 </varlistentry>\r
225 <varlistentry>\r
226 <term>\r
227 &lt;tagname&gt;\r
228 </term>\r
229 <listitem>\r
230 <simpara>\r
231         The name of the tag to create, delete, or describe.\r
232         The new tag name must pass all checks defined by\r
233         <xref linkend="git-check-ref-format(1)" />.  Some of these checks\r
234         may restrict the characters allowed in a tag name.\r
235 </simpara>\r
236 </listitem>\r
237 </varlistentry>\r
238 </variablelist>\r
239 </simplesect>\r
240 <simplesect id="_configuration">\r
241 <title>CONFIGURATION</title>\r
242 <simpara>By default, <emphasis>git tag</emphasis> in sign-with-default mode (-s) will use your\r
243 committer identity (of the form "Your Name &lt;<ulink url="mailto:your@email.address">your@email.address</ulink>&gt;") to\r
244 find a key.  If you want to use a different default key, you can specify\r
245 it in the repository configuration as follows:</simpara>\r
246 <screen>[user]\r
247     signingkey = &lt;gpg-key-id&gt;</screen>\r
248 </simplesect>\r
249 <simplesect id="_discussion">\r
250 <title>DISCUSSION</title>\r
251 <section id="_on_re_tagging">\r
252 <title>On Re-tagging</title>\r
253 <simpara>What should you do when you tag a wrong commit and you would\r
254 want to re-tag?</simpara>\r
255 <simpara>If you never pushed anything out, just re-tag it. Use "-f" to\r
256 replace the old one. And you're done.</simpara>\r
257 <simpara>But if you have pushed things out (or others could just read\r
258 your repository directly), then others will have already seen\r
259 the old tag. In that case you can do one of two things:</simpara>\r
260 <orderedlist numeration="arabic">\r
261 <listitem>\r
262 <simpara>\r
263 The sane thing.\r
264 Just admit you screwed up, and use a different name. Others have\r
265 already seen one tag-name, and if you keep the same name, you\r
266 may be in the situation that two people both have "version X",\r
267 but they actually have <emphasis>different</emphasis> "X"'s.  So just call it "X.1"\r
268 and be done with it.\r
269 </simpara>\r
270 </listitem>\r
271 <listitem>\r
272 <simpara>\r
273 The insane thing.\r
274 You really want to call the new version "X" too, <emphasis>even though</emphasis>\r
275 others have already seen the old one. So just use <emphasis>git tag -f</emphasis>\r
276 again, as if you hadn't already published the old one.\r
277 </simpara>\r
278 </listitem>\r
279 </orderedlist>\r
280 <simpara>However, Git does <emphasis role="strong">not</emphasis> (and it should not) change tags behind\r
281 users back. So if somebody already got the old tag, doing a\r
282 <emphasis>git pull</emphasis> on your tree shouldn't just make them overwrite the old\r
283 one.</simpara>\r
284 <simpara>If somebody got a release tag from you, you cannot just change\r
285 the tag for them by updating your own one. This is a big\r
286 security issue, in that people MUST be able to trust their\r
287 tag-names.  If you really want to do the insane thing, you need\r
288 to just fess up to it, and tell people that you messed up. You\r
289 can do that by making a very public announcement saying:</simpara>\r
290 <screen>Ok, I messed up, and I pushed out an earlier version tagged as X. I\r
291 then fixed something, and retagged the *fixed* tree as X again.\r
293 If you got the wrong tag, and want the new one, please delete\r
294 the old one and fetch the new one by doing:\r
296         git tag -d X\r
297         git fetch origin tag X\r
299 to get my updated tag.\r
301 You can test which tag you have by doing\r
303         git rev-parse X\r
305 which should return 0123456789abcdef.. if you have the new version.\r
307 Sorry for the inconvenience.</screen>\r
308 <simpara>Does this seem a bit complicated?  It <emphasis role="strong">should</emphasis> be. There is no\r
309 way that it would be correct to just "fix" it automatically.\r
310 People need to know that their tags might have been changed.</simpara>\r
311 </section>\r
312 <section id="_on_automatic_following">\r
313 <title>On Automatic following</title>\r
314 <simpara>If you are following somebody else's tree, you are most likely\r
315 using remote-tracking branches (<emphasis>refs/heads/origin</emphasis> in traditional\r
316 layout, or <emphasis>refs/remotes/origin/master</emphasis> in the separate-remote\r
317 layout).  You usually want the tags from the other end.</simpara>\r
318 <simpara>On the other hand, if you are fetching because you would want a\r
319 one-shot merge from somebody else, you typically do not want to\r
320 get tags from there.  This happens more often for people near\r
321 the toplevel but not limited to them.  Mere mortals when pulling\r
322 from each other do not necessarily want to automatically get\r
323 private anchor point tags from the other person.</simpara>\r
324 <simpara>Often, "please pull" messages on the mailing list just provide\r
325 two pieces of information: a repo URL and a branch name; this\r
326 is designed to be easily cut&amp;pasted at the end of a <emphasis>git fetch</emphasis>\r
327 command line:</simpara>\r
328 <screen>Linus, please pull from\r
330         git://git..../proj.git master\r
332 to get the following updates...</screen>\r
333 <simpara>becomes:</simpara>\r
334 <screen>$ git pull git://git..../proj.git master</screen>\r
335 <simpara>In such a case, you do not want to automatically follow the other\r
336 person's tags.</simpara>\r
337 <simpara>One important aspect of git is its distributed nature, which\r
338 largely means there is no inherent "upstream" or\r
339 "downstream" in the system.  On the face of it, the above\r
340 example might seem to indicate that the tag namespace is owned\r
341 by the upper echelon of people and that tags only flow downwards, but\r
342 that is not the case.  It only shows that the usage pattern\r
343 determines who are interested in whose tags.</simpara>\r
344 <simpara>A one-shot pull is a sign that a commit history is now crossing\r
345 the boundary between one circle of people (e.g. "people who are\r
346 primarily interested in the networking part of the kernel") who may\r
347 have their own set of tags (e.g. "this is the third release\r
348 candidate from the networking group to be proposed for general\r
349 consumption with 2.6.21 release") to another circle of people\r
350 (e.g. "people who integrate various subsystem improvements").\r
351 The latter are usually not interested in the detailed tags used\r
352 internally in the former group (that is what "internal" means).\r
353 That is why it is desirable not to follow tags automatically in\r
354 this case.</simpara>\r
355 <simpara>It may well be that among networking people, they may want to\r
356 exchange the tags internal to their group, but in that workflow\r
357 they are most likely tracking each other's progress by\r
358 having remote-tracking branches.  Again, the heuristic to automatically\r
359 follow such tags is a good thing.</simpara>\r
360 </section>\r
361 <section id="_on_backdating_tags">\r
362 <title>On Backdating Tags</title>\r
363 <simpara>If you have imported some changes from another VCS and would like\r
364 to add tags for major releases of your work, it is useful to be able\r
365 to specify the date to embed inside of the tag object; such data in\r
366 the tag object affects, for example, the ordering of tags in the\r
367 gitweb interface.</simpara>\r
368 <simpara>To set the date used in future tag objects, set the environment\r
369 variable GIT_COMMITTER_DATE (see the later discussion of possible\r
370 values; the most common form is "YYYY-MM-DD HH:MM").</simpara>\r
371 <simpara>For example:</simpara>\r
372 <screen>$ GIT_COMMITTER_DATE="2006-10-02 10:31" git tag -s v1.0.1</screen>\r
373 </section>\r
374 </simplesect>\r
375 <simplesect id="_date_formats">\r
376 <title>DATE FORMATS</title>\r
377 <simpara>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables\r
378 support the following date formats:</simpara>\r
379 <variablelist>\r
380 <varlistentry>\r
381 <term>\r
382 Git internal format\r
383 </term>\r
384 <listitem>\r
385 <simpara>\r
386         It is <emphasis>&lt;unix timestamp&gt; &lt;timezone offset&gt;</emphasis>, where <emphasis>&lt;unix\r
387         timestamp&gt;</emphasis> is the number of seconds since the UNIX epoch.\r
388         <emphasis>&lt;timezone offset&gt;</emphasis> is a positive or negative offset from UTC.\r
389         For example CET (which is 2 hours ahead UTC) is <emphasis>+0200</emphasis>.\r
390 </simpara>\r
391 </listitem>\r
392 </varlistentry>\r
393 <varlistentry>\r
394 <term>\r
395 RFC 2822\r
396 </term>\r
397 <listitem>\r
398 <simpara>\r
399         The standard email format as described by RFC 2822, for example\r
400         <emphasis>Thu, 07 Apr 2005 22:13:13 +0200</emphasis>.\r
401 </simpara>\r
402 </listitem>\r
403 </varlistentry>\r
404 <varlistentry>\r
405 <term>\r
406 ISO 8601\r
407 </term>\r
408 <listitem>\r
409 <simpara>\r
410         Time and date specified by the ISO 8601 standard, for example\r
411         <emphasis>2005-04-07T22:13:13</emphasis>. The parser accepts a space instead of the\r
412         <emphasis>T</emphasis> character as well.\r
413 </simpara>\r
414 <note><simpara>In addition, the date part is accepted in the following formats:\r
415 <emphasis>YYYY.MM.DD</emphasis>, <emphasis>MM/DD/YYYY</emphasis> and <emphasis>DD.MM.YYYY</emphasis>.</simpara></note>\r
416 </listitem>\r
417 </varlistentry>\r
418 </variablelist>\r
419 </simplesect>\r
420 <simplesect id="_see_also">\r
421 <title>SEE ALSO</title>\r
422 <simpara><xref linkend="git-check-ref-format(1)" />.</simpara>\r
423 </simplesect>\r
424 <simplesect id="_git">\r
425 <title>GIT</title>\r
426 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
427 </simplesect>\r
428 </article>\r