Use the -f
option to git tag
:
-f
--force
Replace an existing tag with the given name (instead of failing)
You probably want to use -f
in conjunction with -a
to force-create an annotated tag instead of a non-annotated one.
Example
-
Delete the tag on any remote before you push
git push origin :refs/tags/<tagname>
-
Replace the tag to reference the most recent commit
git tag -fa <tagname>
-
Push the tag to the remote origin
git push origin master --tags