You can’t exactly do that. You have to map a new tag to the old one then delete the old tag. Let’s assume we currently have a tag called
old-tag and we want to replace it with a tag named
To link the new tag to the old one:
git tag new-tag old-tag
This creates a
new-tag that references the commit made by
Now we need know how to delete the old tag in Git.
git tag -d old-tag
old-tag. Now the thing about git is it doesn’t let you delete the tag on the remote server just as a precaution. Now you can’t do something like
git push --tags origin master to delete the tag from the remote server.
Here’s how to do it:
git push origin :refs/tags/old-tag
You need to explicitly state that you want that reference updated. This will delete the tag in the remote server.