Skip to content

Commit 77307b2

Browse files
authored
Update tagging.asc
Added a brief section on one way to delete tags both locally and remotely.
1 parent 86cb413 commit 77307b2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

book/02-git-basics/sections/tagging.asc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,25 @@ To [email protected]:schacon/simplegit.git
217217

218218
Now, when someone else clones or pulls from your repository, they will get all your tags as well.
219219

220+
==== Deleting Tags
221+
222+
To delete a tag on your local repository, you can use `git tag -d <tagname>`. For example, we could remove our lightweight tag above as follows:
223+
224+
[source,console]
225+
----
226+
$ git tag -d v1.4-lw
227+
Deleted tag 'v1.4-lw' (was e7d5add)
228+
----
229+
230+
Note that this does not remove the tag from any remote servers. In order to update any remotes, you must use `git push <remote> :refs/tags/<tagname>`:
231+
232+
[source,console]
233+
----
234+
$ git push origin :refs/tags/v1.4-lw
235+
To /[email protected]:schacon/simplegit.git
236+
- [deleted] v1.4-lw
237+
----
238+
220239
==== Checking out Tags
221240

222241
If you want to view the versions of files a tag is pointing to, you can do a git checkout, though this puts your repository in ``detached HEAD'' state, which has some ill side effects:

0 commit comments

Comments
 (0)