git push --tags origin master
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 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
.gitconfig
file location by usinggit config --list --show-origin
and 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
~/.gitconfig
as the path to the config file. For example, if you have Atom installed, useatom ~/.gitconfig
.
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.