
How to Delete Local and Remote Tags in Git
In Git, Tags are used to mark specific points in a repository's history as being important—typically representing release versions (such as v1.0.0 or v2.1.0).
Occasionally, you may create a tag on the wrong commit, assign it an incorrect name, or trigger an automated build pipeline prematurely.
If this happens, you must delete the tag.
Because Git syncs tag metadata separately from branches, deleting a tag on your local machine does not automatically remove it from remote servers (like GitHub).
In this guide, we will step through deleting local tags, pushing deletions to remote repositories, and running batch cleanup commands.
Step 1: Delete the Tag Locally
First, remove the tag reference from your local computer's Git database using the -d (or --delete) flag:
# Delete a local tag named v1.0.0
git tag -d v1.0.0If the tag is found, your terminal will output:
Deleted tag 'v1.0.0' (was a1b2c3d)Step 2: Delete the Remote Tag on the Server
Once deleted locally, you must push the deletion command to your remote repository (typically named origin) to remove it from the server.
Method A: Using the --delete Flag (Modern & Recommended)
The cleanest way to delete a remote tag is using git push with the --delete flag:
# Delete remote tag named v1.0.0 from origin repository
git push origin --delete v1.0.0Method B: Using Refspec Shorthand (Legacy)
If you are running an older version of Git, the --delete flag may not be supported. You can use the traditional refspec syntax by pushing an empty reference to the remote tag:
# Pushes an empty reference to the remote tag, deleting it
git push origin :refs/tags/v1.0.0Both methods instruct the hosting platform (GitHub, GitLab, or Bitbucket) to discard the tag reference.
Step 3: Verify the Tag is Deleted
To verify that the tag is no longer present in your workspace, list all active tags:
# List all local tags
git tagThe deleted tag should no longer appear in the list.
Advanced: Batch Deleting Tags
If you need to perform a major cleanup and delete multiple tags simultaneously, use these scripting filters.
Delete All Local Tags
To wipe out every single tag reference on your local machine:
# Query all tags and pass them to the delete command
git tag | xargs git tag -dSync Local Deletions with Remote
If you have deleted many tags locally and want to tell the remote to update its list to match your local state, run a push prune command:
# Prune local tags tracking that are missing from remote, or push syncs
git fetch --prune --prune-tagsConclusion
Deleting Git tags requires cleaning up both your local database and the remote hosting server. Use git tag -d to delete a tag from your local machine, deploy git push origin --delete to remove the corresponding reference from your remote GitHub server, and utilize batch script pipes when cleaning up release history.