If you’ve accidentally committed a tag and pushed it up to GitHub, it’s quite easy to delete it and then add a new one. For this example, I’m deleting my previous tag “v1.0”, and then adding a new one for the repo at its current state.
1) Delete the v1.0 tag locally:
git tag -d v1.0
2) Delete the v1.0 tag on GitHub (which removes its download link):
git push origin :v1.0
3) Add a new tag for the updated release:
git tag -a v1.0 -m "Version 1.0 Stable"
4) Push the latest tag to GitHub (two dashes):
git push --tags
Thanks for this, helped out a lot.
Ha! Just found a use for this, thanks! (I accidently tagged a repo before committing some changes, so the tagged version wasn’t correct. Just deleted and then re-tagged it – quite handy!)
Step 2 should be replaced by
git push origin :refs/tags/v0.4
See http://nathanhoad.net/how-to-delete-a-remote-git-tag
Doesn’t matter. Both means the same.
Not really the same one infers a link to some reference by that name be it a branch or tag. If you have a branch and tag with the same name it will not work.
This just solved a frustrating issue I had with deleting remote tags – thanks for posting (even though it was a while ago).
Since the tag being deleted (locally and remotely) is supposed to be “v1.0”, shouldn’t the second step reference v1.0 instead of v0.4? For example:
git push origin :v1.0
Thanks! I updated the post at some point and had a typo. Fixed.
Glad to help. However, now it says “v0.1” rather than “v1.0”.
*head desk*
Can any one tell me proper way of creating tags. As per my requirement I want to create tag with some name V1. And in that tag V1, I want to commit and push changes made by developer. Is it possible. Or I am going in wrong direction.
Is it possible to delete tag using the GitHub GUI?