How to Delete a Git Tag Locally and Remotely in Linux Terminal

Git tags provide immutable milestones and release markers (such as v1.0.0 or v2.1.4) that point to specific commits in a software repository’s timeline. However, during continuous integration deployments, version release hotfixes, or branch rollbacks, developers occasionally create tags with typographical errors, attach tags to the wrong commit hash, or need to deprecate an outdated release tag entirely.

Because Git treats local tags and remote tags stored on hosting providers (such as GitHub, GitLab, or Bitbucket) as separate references, removing a tag locally does not automatically purge it from upstream servers. To clean up repository references properly, you must delete the tag from your local working tree and execute an upstream deletion push. This guide demonstrates how to delete Git tags locally and remotely using the Linux terminal.

Listing Existing Git Tags

Before deleting any tag reference, inspect the existing tags in your repository to verify the exact tag name:

git tag

To filter tags matching a specific release pattern, use the -l or --list flag with wildcards:

git tag -l "v1.2.*"

How to Delete a Git Tag Locally

To delete a tag from your local machine, run git tag followed by the -d (or --delete) flag and the target tag name:

git tag -d v1.0.0

Git will respond with a confirmation message:

Deleted tag 'v1.0.0' (was a1b2c3d)

At this point, the tag reference is purged from your local .git/refs/tags/ directory, but it still exists on the remote repository.

How to Delete a Remote Git Tag

To propagate the deletion to your upstream remote server (such as GitHub), you push a delete instruction to the remote repository. There are two standard syntax approaches:

Method 1: Using the Modern –delete Flag (Recommended)

Modern versions of Git provide an explicit and readable flag:

git push origin --delete v1.0.0

Git will contact the remote repository (assuming default remote name origin) and confirm:

To github.com:organisation/project.git
 - [deleted]         v1.0.0

Method 2: Using the Refspec Colon Prefix Syntax

Older Git workflows and build pipelines frequently utilise the refspec colon prefix, which pushes an empty reference to the remote tag name:

git push origin :refs/tags/v1.0.0

Both methods accomplish the exact same outcome on the remote server.

Deleting Multiple Tags Simultaneously

If you need to batch delete multiple release tags in one command:

To delete multiple tags locally:

git tag -d v1.0.1 v1.0.2 v1.0.3

To delete multiple tags remotely in a single push:

git push origin --delete v1.0.1 v1.0.2 v1.0.3

How Other Collaborators Can Sync Deleted Tags

When another team member deletes a remote tag, running a simple git pull or git fetch on your machine will not automatically erase obsolete tags from your local repository. To clean up dangling local tags that no longer exist on the remote repository, collaborators should run:

git fetch --prune --prune-tags

This command synchronises tag references against the remote server and prunes any stale local tags cleanly.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.