6 git-tag - Create, list, delete or verify a tag object signed with GPG
12 'git-tag' [-a | -s | -u <key-id>] [-f | -v] [-m <msg> | -F <file>] <name> [<head>]
13 'git-tag' -d <name>...
14 'git-tag' -l [<pattern>]
18 Adds a 'tag' reference in `.git/refs/tags/`
20 Unless `-f` is given, the tag must not yet exist in
21 `.git/refs/tags/` directory.
23 If one of `-a`, `-s`, or `-u <key-id>` is passed, the command
24 creates a 'tag' object, and requires the tag message. Unless
25 `-m <msg>` is given, an editor is started for the user to type
28 Otherwise just the SHA1 object name of the commit object is
29 written (i.e. a lightweight tag).
31 A GnuPG signed tag object will be created when `-s` or `-u
32 <key-id>` is used. When `-u <key-id>` is not used, the
33 committer identity for the current user is used to find the
34 GnuPG key for signing.
36 `-d <tag>` deletes the tag.
38 `-v <tag>` verifies the gpg signature of the tag.
40 `-l <pattern>` lists tags that match the given pattern (or all
41 if no pattern is given).
46 Make an unsigned, annotated tag object
49 Make a GPG-signed tag, using the default e-mail address's key
52 Make a GPG-signed tag, using the given key
55 Replace an existing tag with the given name (instead of failing)
58 Delete existing tags with the given names.
61 Verify the gpg signature of given the tag
64 List tags that match the given pattern (or all if no pattern is given).
67 Use the given tag message (instead of prompting)
70 Take the tag message from the given file. Use '-' to
71 read the message from the standard input.
75 By default, git-tag in sign-with-default mode (-s) will use your
76 committer identity (of the form "Your Name <your@email.address>") to
77 find a key. If you want to use a different default key, you can specify
78 it in the repository configuration as follows:
81 signingkey = <gpg-key-id>
90 What should you do when you tag a wrong commit and you would
93 If you never pushed anything out, just re-tag it. Use "-f" to
94 replace the old one. And you're done.
96 But if you have pushed things out (or others could just read
97 your repository directly), then others will have already seen
98 the old tag. In that case you can do one of two things:
101 Just admit you screwed up, and use a different name. Others have
102 already seen one tag-name, and if you keep the same name, you
103 may be in the situation that two people both have "version X",
104 but they actually have 'different' "X"'s. So just call it "X.1"
108 You really want to call the new version "X" too, 'even though'
109 others have already seen the old one. So just use "git tag -f"
110 again, as if you hadn't already published the old one.
112 However, Git does *not* (and it should not)change tags behind
113 users back. So if somebody already got the old tag, doing a "git
114 pull" on your tree shouldn't just make them overwrite the old
117 If somebody got a release tag from you, you cannot just change
118 the tag for them by updating your own one. This is a big
119 security issue, in that people MUST be able to trust their
120 tag-names. If you really want to do the insane thing, you need
121 to just fess up to it, and tell people that you messed up. You
122 can do that by making a very public announcement saying:
125 Ok, I messed up, and I pushed out an earlier version tagged as X. I
126 then fixed something, and retagged the *fixed* tree as X again.
128 If you got the wrong tag, and want the new one, please delete
129 the old one and fetch the new one by doing:
132 git fetch origin tag X
134 to get my updated tag.
136 You can test which tag you have by doing
140 which should return 0123456789abcdef.. if you have the new version.
142 Sorry for inconvenience.
145 Does this seem a bit complicated? It *should* be. There is no
146 way that it would be correct to just "fix" it behind peoples
147 backs. People need to know that their tags might have been
151 On Automatic following
152 ~~~~~~~~~~~~~~~~~~~~~~
154 If you are following somebody else's tree, you are most likely
155 using tracking branches (`refs/heads/origin` in traditional
156 layout, or `refs/remotes/origin/master` in the separate-remote
157 layout). You usually want the tags from the other end.
159 On the other hand, if you are fetching because you would want a
160 one-shot merge from somebody else, you typically do not want to
161 get tags from there. This happens more often for people near
162 the toplevel but not limited to them. Mere mortals when pulling
163 from each other do not necessarily want to automatically get
164 private anchor point tags from the other person.
166 You would notice "please pull" messages on the mailing list says
167 repo URL and branch name alone. This is designed to be easily
168 cut&pasted to "git fetch" command line:
171 Linus, please pull from
173 git://git..../proj.git master
175 to get the following updates...
181 $ git pull git://git..../proj.git master
184 In such a case, you do not want to automatically follow other's
187 One important aspect of git is it is distributed, and being
188 distributed largely means there is no inherent "upstream" or
189 "downstream" in the system. On the face of it, the above
190 example might seem to indicate that the tag namespace is owned
191 by upper echelon of people and tags only flow downwards, but
192 that is not the case. It only shows that the usage pattern
193 determines who are interested in whose tags.
195 A one-shot pull is a sign that a commit history is now crossing
196 the boundary between one circle of people (e.g. "people who are
197 primarily interested in networking part of the kernel") who may
198 have their own set of tags (e.g. "this is the third release
199 candidate from the networking group to be proposed for general
200 consumption with 2.6.21 release") to another circle of people
201 (e.g. "people who integrate various subsystem improvements").
202 The latter are usually not interested in the detailed tags used
203 internally in the former group (that is what "internal" means).
204 That is why it is desirable not to follow tags automatically in
207 It may well be that among networking people, they may want to
208 exchange the tags internal to their group, but in that workflow
209 they are most likely tracking with each other's progress by
210 having tracking branches. Again, the heuristic to automatically
211 follow such tags is a good thing.
216 Written by Linus Torvalds <torvalds@osdl.org>,
217 Junio C Hamano <junkio@cox.net> and Chris Wright <chrisw@osdl.org>.
221 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
225 Part of the gitlink:git[7] suite