Skip to main content

How to Delete Tags in Git

Short answer

To delete a local Git tag, run git tag -d <tag-name>. To delete a remote tag, push an empty reference: git push --delete origin <tag-name> (or the equivalent git push origin :refs/tags/<tag-name>). Both steps are independent — deleting the local tag does not automatically remove it from the remote, and vice versa, so you must run both commands if you want it gone from both places. Collaborators who have already fetched the deleted tag will keep it in their local repositories until they run git fetch --prune 'refs/tags/*:refs/tags/*' (or configure fetch.pruneTags = true globally). If you are deleting a tag to recreate it on a different commit (for example to correct a mis-tagged release), communicate this clearly to the team and provide updated fetch instructions so everyone is aligned.

In Git, tags are commonly used to mark significant events like releases, bug fixes, or provide additional information about a commit. However, there are situations where you may need to delete them, either locally or remotely.

Maybe you misspelled the correct name of the tag, or you are cleaning up your repository and noticed some old tags lingering around. Deleting tags is a good practice to reduce clutter and keep your repository tidy. Just like branches, tags — especially annotated tags saved as full objects — consume disk space.

Deleting a tag is quite straightforward, whether in your local project or on your remote repository. Let's find out how you can quickly and easily delete tags in Git!

The Git Cheat Sheet

No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!

Free. We email you a ZIP with our cheat sheets.


Deleting a Local Tag in Git

To delete a Git tag in your local project, you can use the git tag -d command (the -d option is an alias for --delete).

git tag -d tag-name

You can use this command to delete multiple local tags by specifying multiple tag names:

git tag -d tag-name1 tag-name2 tag-name3

To verify that the tag has been successfully deleted, you can type the git tag -l command (or git tag --list) to display a list of your current tags.

git tag -l

Deleting a Remote Tag in Git

To delete a remote tag, use the git push command with the --delete option, as shown in the example below:

git push --delete origin tag-name

Just as for local tags, you can also use this command to delete multiple remote tags at once:

git push --delete origin tag-name1 tag-name2 tag-name3

If the name of your tag is the same as a branch and you attempt to delete it, you will run into an error:

error: dst refspec tag-name matches more than one.
error: failed to push some refs to 'https://remote_repository_url'

This error occurs when the tag-name reference matches another reference in the remote repository, meaning there are multiple references (such as branches or tags) with the same name as the one you specified in the remote repository.

To address this issue, you should specify the tag name using the 'refs' syntax. Git uses refs/tags/ as a prefix to reference tags.

This is how the command would look like:

git push origin --delete refs/tags/<tag_name>

Alternatively, you could also use this command instead:

git push origin :refs/tags/tag-name
No Command Line Needed

Deleting Tags in Tower

In case you are using the Tower Git client, you can easily delete a tag by right-clicking on it and selecting the appropriate option from the context menu.

Tower — Delete Tag

Free download

Download the Cheat Sheet

Get 18 of our most popular Cheat Sheets in one handy ZIP!