6 git-tag - Create, list, delete or verify a tag object signed with GPG
12 'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]
13 [(--trailer <token>[(=|:)<value>])...]
14 <tagname> [<commit> | <object>]
15 'git tag' -d <tagname>...
16 'git tag' [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
17 [--points-at <object>] [--column[=<options>] | --no-column]
18 [--create-reflog] [--sort=<key>] [--format=<format>]
19 [--merged <commit>] [--no-merged <commit>] [<pattern>...]
20 'git tag' -v [--format=<format>] <tagname>...
25 Add a tag reference in `refs/tags/`, unless `-d/-l/-v` is given
26 to delete, list or verify tags.
28 Unless `-f` is given, the named tag must not yet exist.
30 If one of `-a`, `-s`, or `-u <key-id>` is passed, the command
31 creates a 'tag' object, and requires a tag message. Unless
32 `-m <msg>` or `-F <file>` is given, an editor is started for the user to type
35 If `-m <msg>` or `-F <file>` or `--trailer <token>[=<value>]` is given
36 and `-a`, `-s`, and `-u <key-id>` are absent, `-a` is implied.
38 Otherwise, a tag reference that points directly at the given object
39 (i.e., a lightweight tag) is created.
41 A GnuPG signed tag object will be created when `-s` or `-u
42 <key-id>` is used. When `-u <key-id>` is not used, the
43 committer identity for the current user is used to find the
44 GnuPG key for signing. The configuration variable `gpg.program`
45 is used to specify custom GnuPG binary.
47 Tag objects (created with `-a`, `-s`, or `-u`) are called "annotated"
48 tags; they contain a creation date, the tagger name and e-mail, a
49 tagging message, and an optional GnuPG signature. Whereas a
50 "lightweight" tag is simply a name for an object (usually a commit
53 Annotated tags are meant for release while lightweight tags are meant
54 for private or temporary object labels. For this reason, some git
55 commands for naming objects (like `git describe`) will ignore
56 lightweight tags by default.
63 Make an unsigned, annotated tag object
67 Make a GPG-signed tag, using the default e-mail address's key.
68 The default behavior of tag GPG-signing is controlled by `tag.gpgSign`
69 configuration variable if it exists, or disabled otherwise.
70 See linkgit:git-config[1].
73 Override `tag.gpgSign` configuration variable that is
74 set to force each and every tag to be signed.
77 --local-user=<key-id>::
78 Make a GPG-signed tag, using the given key.
82 Replace an existing tag with the given name (instead of failing)
86 Delete existing tags with the given names.
90 Verify the GPG signature of the given tag names.
93 <num> specifies how many lines from the annotation, if any,
94 are printed when using -l. Implies `--list`.
96 The default is not to print any annotation lines.
97 If no number is given to `-n`, only the first line is printed.
98 If the tag is not annotated, the commit message is displayed instead.
102 List tags. With optional `<pattern>...`, e.g. `git tag --list
103 'v-*'`, list only the tags that match the pattern(s).
105 Running "git tag" without arguments also lists all tags. The pattern
106 is a shell wildcard (i.e., matched using fnmatch(3)). Multiple
107 patterns may be given; if any of them matches, the tag is shown.
109 This option is implicitly supplied if any other list-like option such
110 as `--contains` is provided. See the documentation for each of those
114 Sort based on the key given. Prefix `-` to sort in
115 descending order of the value. You may use the --sort=<key> option
116 multiple times, in which case the last key becomes the primary
117 key. Also supports "version:refname" or "v:refname" (tag
118 names are treated as versions). The "version:refname" sort
119 order can also be affected by the "versionsort.suffix"
120 configuration variable.
121 The keys supported are the same as those in `git for-each-ref`.
122 Sort order defaults to the value configured for the `tag.sort`
123 variable if it exists, or lexicographic order otherwise. See
124 linkgit:git-config[1].
127 Respect any colors specified in the `--format` option. The
128 `<when>` field must be one of `always`, `never`, or `auto` (if
129 `<when>` is absent, behave as if `always` was given).
133 Sorting and filtering tags are case insensitive.
136 Do not print a newline after formatted refs where the format expands
139 --column[=<options>]::
141 Display tag listing in columns. See configuration variable
142 `column.tag` for option syntax. `--column` and `--no-column`
143 without options are equivalent to 'always' and 'never' respectively.
145 This option is only applicable when listing tags without annotation lines.
147 --contains [<commit>]::
148 Only list tags which contain the specified commit (HEAD if not
149 specified). Implies `--list`.
151 --no-contains [<commit>]::
152 Only list tags which don't contain the specified commit (HEAD if
153 not specified). Implies `--list`.
155 --merged [<commit>]::
156 Only list tags whose commits are reachable from the specified
157 commit (`HEAD` if not specified).
159 --no-merged [<commit>]::
160 Only list tags whose commits are not reachable from the specified
161 commit (`HEAD` if not specified).
163 --points-at <object>::
164 Only list tags of the given object (HEAD if not
165 specified). Implies `--list`.
169 Use the given tag message (instead of prompting).
170 If multiple `-m` options are given, their values are
171 concatenated as separate paragraphs.
172 Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
177 Take the tag message from the given file. Use '-' to
178 read the message from the standard input.
179 Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
182 --trailer <token>[(=|:)<value>]::
183 Specify a (<token>, <value>) pair that should be applied as a
184 trailer. (e.g. `git tag --trailer "Custom-Key: value"`
185 will add a "Custom-Key" trailer to the tag message.)
186 The `trailer.*` configuration variables
187 (linkgit:git-interpret-trailers[1]) can be used to define if
188 a duplicated trailer is omitted, where in the run of trailers
189 each trailer would appear, and other details.
190 The trailers can be extracted in `git tag --list`, using
191 `--format="%(trailers)"` placeholder.
195 The message taken from file with `-F` and command line with
196 `-m` are usually used as the tag message unmodified.
197 This option lets you further edit the message taken from these sources.
200 This option sets how the tag message is cleaned up.
201 The '<mode>' can be one of 'verbatim', 'whitespace' and 'strip'. The
202 'strip' mode is default. The 'verbatim' mode does not change message at
203 all, 'whitespace' removes just leading/trailing whitespace lines and
204 'strip' removes both whitespace and commentary.
207 Create a reflog for the tag. To globally enable reflogs for tags, see
208 `core.logAllRefUpdates` in linkgit:git-config[1].
209 The negated form `--no-create-reflog` only overrides an earlier
210 `--create-reflog`, but currently does not negate the setting of
211 `core.logAllRefUpdates`.
214 A string that interpolates `%(fieldname)` from a tag ref being shown
215 and the object it points at. The format is the same as
216 that of linkgit:git-for-each-ref[1]. When unspecified,
217 defaults to `%(refname:strip=2)`.
220 The name of the tag to create, delete, or describe.
221 The new tag name must pass all checks defined by
222 linkgit:git-check-ref-format[1]. Some of these checks
223 may restrict the characters allowed in a tag name.
227 The object that the new tag will refer to, usually a commit.
232 By default, 'git tag' in sign-with-default mode (-s) will use your
233 committer identity (of the form `Your Name <your@email.address>`) to
234 find a key. If you want to use a different default key, you can specify
235 it in the repository configuration as follows:
237 -------------------------------------
239 signingKey = <gpg-key-id>
240 -------------------------------------
242 `pager.tag` is only respected when listing tags, i.e., when `-l` is
243 used or implied. The default is to use a pager.
244 See linkgit:git-config[1].
252 What should you do when you tag a wrong commit and you would
255 If you never pushed anything out, just re-tag it. Use "-f" to
256 replace the old one. And you're done.
258 But if you have pushed things out (or others could just read
259 your repository directly), then others will have already seen
260 the old tag. In that case you can do one of two things:
263 Just admit you screwed up, and use a different name. Others have
264 already seen one tag-name, and if you keep the same name, you
265 may be in the situation that two people both have "version X",
266 but they actually have 'different' "X"'s. So just call it "X.1"
270 You really want to call the new version "X" too, 'even though'
271 others have already seen the old one. So just use 'git tag -f'
272 again, as if you hadn't already published the old one.
274 However, Git does *not* (and it should not) change tags behind
275 users back. So if somebody already got the old tag, doing a
276 'git pull' on your tree shouldn't just make them overwrite the old
279 If somebody got a release tag from you, you cannot just change
280 the tag for them by updating your own one. This is a big
281 security issue, in that people MUST be able to trust their
282 tag-names. If you really want to do the insane thing, you need
283 to just fess up to it, and tell people that you messed up. You
284 can do that by making a very public announcement saying:
287 Ok, I messed up, and I pushed out an earlier version tagged as X. I
288 then fixed something, and retagged the *fixed* tree as X again.
290 If you got the wrong tag, and want the new one, please delete
291 the old one and fetch the new one by doing:
294 git fetch origin tag X
296 to get my updated tag.
298 You can test which tag you have by doing
302 which should return 0123456789abcdef.. if you have the new version.
304 Sorry for the inconvenience.
307 Does this seem a bit complicated? It *should* be. There is no
308 way that it would be correct to just "fix" it automatically.
309 People need to know that their tags might have been changed.
312 On Automatic following
313 ~~~~~~~~~~~~~~~~~~~~~~
315 If you are following somebody else's tree, you are most likely
316 using remote-tracking branches (eg. `refs/remotes/origin/master`).
317 You usually want the tags from the other end.
319 On the other hand, if you are fetching because you would want a
320 one-shot merge from somebody else, you typically do not want to
321 get tags from there. This happens more often for people near
322 the toplevel but not limited to them. Mere mortals when pulling
323 from each other do not necessarily want to automatically get
324 private anchor point tags from the other person.
326 Often, "please pull" messages on the mailing list just provide
327 two pieces of information: a repo URL and a branch name; this
328 is designed to be easily cut&pasted at the end of a 'git fetch'
332 Linus, please pull from
334 git://git..../proj.git master
336 to get the following updates...
342 $ git pull git://git..../proj.git master
345 In such a case, you do not want to automatically follow the other
348 One important aspect of Git is its distributed nature, which
349 largely means there is no inherent "upstream" or
350 "downstream" in the system. On the face of it, the above
351 example might seem to indicate that the tag namespace is owned
352 by the upper echelon of people and that tags only flow downwards, but
353 that is not the case. It only shows that the usage pattern
354 determines who are interested in whose tags.
356 A one-shot pull is a sign that a commit history is now crossing
357 the boundary between one circle of people (e.g. "people who are
358 primarily interested in the networking part of the kernel") who may
359 have their own set of tags (e.g. "this is the third release
360 candidate from the networking group to be proposed for general
361 consumption with 2.6.21 release") to another circle of people
362 (e.g. "people who integrate various subsystem improvements").
363 The latter are usually not interested in the detailed tags used
364 internally in the former group (that is what "internal" means).
365 That is why it is desirable not to follow tags automatically in
368 It may well be that among networking people, they may want to
369 exchange the tags internal to their group, but in that workflow
370 they are most likely tracking each other's progress by
371 having remote-tracking branches. Again, the heuristic to automatically
372 follow such tags is a good thing.
378 If you have imported some changes from another VCS and would like
379 to add tags for major releases of your work, it is useful to be able
380 to specify the date to embed inside of the tag object; such data in
381 the tag object affects, for example, the ordering of tags in the
384 To set the date used in future tag objects, set the environment
385 variable GIT_COMMITTER_DATE (see the later discussion of possible
386 values; the most common form is "YYYY-MM-DD HH:MM").
391 $ GIT_COMMITTER_DATE="2006-10-02 10:31" git tag -s v1.0.1
394 include::date-formats.txt[]
399 `$GIT_DIR/TAG_EDITMSG`::
400 This file contains the message of an in-progress annotated
401 tag. If `git tag` exits due to an error before creating an
402 annotated tag then the tag message that has been provided by the
403 user in an editor session will be available in this file, but
404 may be overwritten by the next invocation of `git tag`.
409 include::ref-reachability-filters.txt[]
413 linkgit:git-check-ref-format[1].
414 linkgit:git-config[1].
418 Part of the linkgit:git[1] suite