How to delete a remote tag?
The explanation for delete a remote tag
We can delete a remote tag by pushing an ’empty’ reference to the remote tag name:
git push origin :tagname
Or, if you want it more expressively, at that time use the --delete
option. Or else if you have the old version then use -d
. Then it will be as follow:
git push --delete origin tagname
Note that git has tag namespace and branch namespace so you may use the same name for a branch and for a tag. If you want to make sure that you cannot accidentally remove the branch instead of the tag, you can specify full ref which will never delete a branch:
git push origin :refs/tags/tagname
And you also want to delete the local tag, so that you can use:
git tag --delete tagname
If you push a branch tag or any reference to a remote repository involves specifying What is the source and what is the destination.
git push remote-repo source-ref:destination-ref
And where you get a real-world example where you push your master branch to the origin’s master branch is:
git push origin refs/heads/master:refs/heads/master
Which because of default paths, can be shortened to:
git push origin master:master
Here we have tags. They will also work in the same way. So we have:
git push origin refs/tags/release-1.0:refs/tags/release-1.0
This can be written in short that is as follow:
git push origin release-1.0:release-1.0
Also, read How do I delete a Git branch locally and remotely?