How to Delete Remote Git Tags

Tags are references that show particular points in Git history. The primary function of tagging is to capture a point in a Git history that marks version release.

While creating a tag, typos can be made and force you to delete it. Here, we are going to show you how to remove remote tags.

Deleting a remote Git tag

To delete a remote git tag, use the following command and specify the tag name (suppose, the name of remote is origin, which is by default):

git push --delete origin <tag-name>

As you can see, the command for deleting a branch and a tag is the same, so, in case of having a branch and a tag with the same name, you should use the refs syntax to specify that you want to delete exactly the tag:

git push origin :refs/tags/<tag-name>

Describing Git Tags

Git tags allow tagging specific points in the history of repository and return to them later. After creating a tag, it won't have commit history. There are two kinds of tags supported by Git: annotated and lightweight tags. The difference between them is the amount of metadata they store. Another difference is that annotated tags are public, and lightweight tags are private.

Git Push Origin and Git Push

The git push command implicitly pushes your work to a remote repository. By default, that remote repository is the origin. The git push origin explicitly specifies to be pushed into a repository called origin.

The git push origin is usually used only when there are multiple remote repositories, and you want to define which remote repository should be used for the push.