i18n: grep: mark parseopt strings for translation
[git/jnareb-git.git] / Documentation / git-tag.txt
blobe36a7c3d1e11e38950c74b32ab4f1ac9a4683a41
1 git-tag(1)
2 ==========
4 NAME
5 ----
6 git-tag - Create, list, delete or verify a tag object signed with GPG
9 SYNOPSIS
10 --------
11 [verse]
12 'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]
13         <tagname> [<commit> | <object>]
14 'git tag' -d <tagname>...
15 'git tag' [-n[<num>]] -l [--contains <commit>] [--points-at <object>]
16         [--column[=<options>] | --no-column] [<pattern>...]
17         [<pattern>...]
18 'git tag' -v <tagname>...
20 DESCRIPTION
21 -----------
23 Add a tag reference in `.git/refs/tags/`, unless `-d/-l/-v` is given
24 to delete, list or verify tags.
26 Unless `-f` is given, the tag to be created must not yet exist in the
27 `.git/refs/tags/` directory.
29 If one of `-a`, `-s`, or `-u <key-id>` is passed, the command
30 creates a 'tag' object, and requires a tag message.  Unless
31 `-m <msg>` or `-F <file>` is given, an editor is started for the user to type
32 in the tag message.
34 If `-m <msg>` or `-F <file>` is given and `-a`, `-s`, and `-u <key-id>`
35 are absent, `-a` is implied.
37 Otherwise just a tag reference for the SHA1 object name of the commit object is
38 created (i.e. a lightweight tag).
40 A GnuPG signed tag object will be created when `-s` or `-u
41 <key-id>` is used.  When `-u <key-id>` is not used, the
42 committer identity for the current user is used to find the
43 GnuPG key for signing.  The configuration variable `gpg.program`
44 is used to specify custom GnuPG binary.
47 OPTIONS
48 -------
49 -a::
50 --annotate::
51         Make an unsigned, annotated tag object
53 -s::
54 --sign::
55         Make a GPG-signed tag, using the default e-mail address's key.
57 -u <key-id>::
58 --local-user=<key-id>::
59         Make a GPG-signed tag, using the given key.
61 -f::
62 --force::
63         Replace an existing tag with the given name (instead of failing)
65 -d::
66 --delete::
67         Delete existing tags with the given names.
69 -v::
70 --verify::
71         Verify the gpg signature of the given tag names.
73 -n<num>::
74         <num> specifies how many lines from the annotation, if any,
75         are printed when using -l.
76         The default is not to print any annotation lines.
77         If no number is given to `-n`, only the first line is printed.
78         If the tag is not annotated, the commit message is displayed instead.
80 -l <pattern>::
81 --list <pattern>::
82         List tags with names that match the given pattern (or all if no
83         pattern is given).  Running "git tag" without arguments also
84         lists all tags. The pattern is a shell wildcard (i.e., matched
85         using fnmatch(3)).  Multiple patterns may be given; if any of
86         them matches, the tag is shown.
88 --column[=<options>]::
89 --no-column::
90         Display tag listing in columns. See configuration variable
91         column.tag for option syntax.`--column` and `--no-column`
92         without options are equivalent to 'always' and 'never' respectively.
94 This option is only applicable when listing tags without annotation lines.
96 --contains <commit>::
97         Only list tags which contain the specified commit.
99 --points-at <object>::
100         Only list tags of the given object.
102 -m <msg>::
103 --message=<msg>::
104         Use the given tag message (instead of prompting).
105         If multiple `-m` options are given, their values are
106         concatenated as separate paragraphs.
107         Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
108         is given.
110 -F <file>::
111 --file=<file>::
112         Take the tag message from the given file.  Use '-' to
113         read the message from the standard input.
114         Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
115         is given.
117 --cleanup=<mode>::
118         This option sets how the tag message is cleaned up.
119         The  '<mode>' can be one of 'verbatim', 'whitespace' and 'strip'.  The
120         'strip' mode is default. The 'verbatim' mode does not change message at
121         all, 'whitespace' removes just leading/trailing whitespace lines and
122         'strip' removes both whitespace and commentary.
124 <tagname>::
125         The name of the tag to create, delete, or describe.
126         The new tag name must pass all checks defined by
127         linkgit:git-check-ref-format[1].  Some of these checks
128         may restrict the characters allowed in a tag name.
130 CONFIGURATION
131 -------------
132 By default, 'git tag' in sign-with-default mode (-s) will use your
133 committer identity (of the form "Your Name <your@email.address>") to
134 find a key.  If you want to use a different default key, you can specify
135 it in the repository configuration as follows:
137 -------------------------------------
138 [user]
139     signingkey = <gpg-key-id>
140 -------------------------------------
143 DISCUSSION
144 ----------
146 On Re-tagging
147 ~~~~~~~~~~~~~
149 What should you do when you tag a wrong commit and you would
150 want to re-tag?
152 If you never pushed anything out, just re-tag it. Use "-f" to
153 replace the old one. And you're done.
155 But if you have pushed things out (or others could just read
156 your repository directly), then others will have already seen
157 the old tag. In that case you can do one of two things:
159 . The sane thing.
160 Just admit you screwed up, and use a different name. Others have
161 already seen one tag-name, and if you keep the same name, you
162 may be in the situation that two people both have "version X",
163 but they actually have 'different' "X"'s.  So just call it "X.1"
164 and be done with it.
166 . The insane thing.
167 You really want to call the new version "X" too, 'even though'
168 others have already seen the old one. So just use 'git tag -f'
169 again, as if you hadn't already published the old one.
171 However, Git does *not* (and it should not) change tags behind
172 users back. So if somebody already got the old tag, doing a
173 'git pull' on your tree shouldn't just make them overwrite the old
174 one.
176 If somebody got a release tag from you, you cannot just change
177 the tag for them by updating your own one. This is a big
178 security issue, in that people MUST be able to trust their
179 tag-names.  If you really want to do the insane thing, you need
180 to just fess up to it, and tell people that you messed up. You
181 can do that by making a very public announcement saying:
183 ------------
184 Ok, I messed up, and I pushed out an earlier version tagged as X. I
185 then fixed something, and retagged the *fixed* tree as X again.
187 If you got the wrong tag, and want the new one, please delete
188 the old one and fetch the new one by doing:
190         git tag -d X
191         git fetch origin tag X
193 to get my updated tag.
195 You can test which tag you have by doing
197         git rev-parse X
199 which should return 0123456789abcdef.. if you have the new version.
201 Sorry for the inconvenience.
202 ------------
204 Does this seem a bit complicated?  It *should* be. There is no
205 way that it would be correct to just "fix" it automatically.
206 People need to know that their tags might have been changed.
209 On Automatic following
210 ~~~~~~~~~~~~~~~~~~~~~~
212 If you are following somebody else's tree, you are most likely
213 using remote-tracking branches (`refs/heads/origin` in traditional
214 layout, or `refs/remotes/origin/master` in the separate-remote
215 layout).  You usually want the tags from the other end.
217 On the other hand, if you are fetching because you would want a
218 one-shot merge from somebody else, you typically do not want to
219 get tags from there.  This happens more often for people near
220 the toplevel but not limited to them.  Mere mortals when pulling
221 from each other do not necessarily want to automatically get
222 private anchor point tags from the other person.
224 Often, "please pull" messages on the mailing list just provide
225 two pieces of information: a repo URL and a branch name; this
226 is designed to be easily cut&pasted at the end of a 'git fetch'
227 command line:
229 ------------
230 Linus, please pull from
232         git://git..../proj.git master
234 to get the following updates...
235 ------------
237 becomes:
239 ------------
240 $ git pull git://git..../proj.git master
241 ------------
243 In such a case, you do not want to automatically follow the other
244 person's tags.
246 One important aspect of git is its distributed nature, which
247 largely means there is no inherent "upstream" or
248 "downstream" in the system.  On the face of it, the above
249 example might seem to indicate that the tag namespace is owned
250 by the upper echelon of people and that tags only flow downwards, but
251 that is not the case.  It only shows that the usage pattern
252 determines who are interested in whose tags.
254 A one-shot pull is a sign that a commit history is now crossing
255 the boundary between one circle of people (e.g. "people who are
256 primarily interested in the networking part of the kernel") who may
257 have their own set of tags (e.g. "this is the third release
258 candidate from the networking group to be proposed for general
259 consumption with 2.6.21 release") to another circle of people
260 (e.g. "people who integrate various subsystem improvements").
261 The latter are usually not interested in the detailed tags used
262 internally in the former group (that is what "internal" means).
263 That is why it is desirable not to follow tags automatically in
264 this case.
266 It may well be that among networking people, they may want to
267 exchange the tags internal to their group, but in that workflow
268 they are most likely tracking each other's progress by
269 having remote-tracking branches.  Again, the heuristic to automatically
270 follow such tags is a good thing.
273 On Backdating Tags
274 ~~~~~~~~~~~~~~~~~~
276 If you have imported some changes from another VCS and would like
277 to add tags for major releases of your work, it is useful to be able
278 to specify the date to embed inside of the tag object; such data in
279 the tag object affects, for example, the ordering of tags in the
280 gitweb interface.
282 To set the date used in future tag objects, set the environment
283 variable GIT_COMMITTER_DATE (see the later discussion of possible
284 values; the most common form is "YYYY-MM-DD HH:MM").
286 For example:
288 ------------
289 $ GIT_COMMITTER_DATE="2006-10-02 10:31" git tag -s v1.0.1
290 ------------
292 include::date-formats.txt[]
294 SEE ALSO
295 --------
296 linkgit:git-check-ref-format[1].
300 Part of the linkgit:git[1] suite