you'll know the pain of having the push rejected with the tag still applied remotely. In this post by Nathan Hoad, you'll find the needed git commands to remove the remote tag, but it's not that easy to remember.
git push --tags origin master
git tag -d 12345 git push origin :refs/tags/12345
So we're going to make a nice little shell command to do it for you!
First open the global user defined
.gitconfig file. From the command line:
- You can either find the user
.gitconfigfile location by using
git config --list --show-originand finding it in the wall of text. Then, open the file in your favorite editor, or
- To load the file directly into your favorite editor, use
~/.gitconfigas the path to the config file. For example, if you have Atom installed, use
Now under the
[alias] block (add it if you don't see it), add the untag alias:
[alias] untag = "!sh -c 'git tag -d $0 && git push origin :refs/tags/$0'"
And you're done!
To use the command, use the alias followed by the tag to delete & remove from the remote branch
git untag v1.0.0You can find a lot more useful git aliases from the Git basics documentation.