Git: Remove a remote tag


Git: Remove a remote tag

Posted by Luis Majano
Feb 08, 2011 11:14:57 UTC
This is something I want to blog in order to save it for posterity so I don't go crazy looking for this.  I have a remote tag I committed but I need to remove it for whatever reason, how do I do this with git?

You do this in two easy steps:

  1. Remove the local tag either through your favorite GUI or via: git tag -d "tag name"
  2. Push the removed tag to the remote origin: git push origin :refs/tags/"tag name"
The key here is that you push a non-existent tag, so it basically removes it from the remote repository.  That's it!

Aaron West

Luis, I use the following to create new tags.

git tag -a [tag_name] [commit_hash] -m ["Tag message"]

Then, I push tag updates to the origin with:

git push --tags

I think - though I'm not certain - git push --tags will push all tag changes including deletes.

Aaron West

NOTE: In the previous comment I had two dashes before the "tags" switch in the command. For some reason only one dash is showing in the comment. If you use this command make sure you use two dashes.

Kendall

git push ---tags does not push deletes on github (just verified)