Tags in Git are used to label specific commits (to mark releases, for example).
Once created locally, Git tags can be pushed to a remote repository.
In this note i will show how to delete local Git tags using a git tag --delete
command and how to remove Git tags from a remote repository.
Cool Tip: How to list all tags in Git! Read more →
Git Delete Tag
Use the following commands to delete Git tags locally and remotely.
Delete Remote Git Tag
Info: As Git has a tag namespace and a branch namespace, you may use the same name for a branch and for a tag. To make sure that you won’t accidentally remove a branch instead of a tag, it is more preferable to specify the full ref while deleting a remote tag.
Delete a remote Git tag:
$ git push origin :refs/tags/<tag_name>
Alternatively, a remote Git tag can be deleted as follows:
$ git push -d origin <tag_name>
– or –
$ git push --delete origin <tag_name>
Remove Local Git Tag
Remove a Git tag from a local repository:
$ git tag -d <tag_name>
– or –
$ git tag --delete <tag_name>