LinuxCommandLibrary

git-delete-tag

Delete tags from the local repository

TLDR

Delete a tag

$ git delete-tag [tag_version]
copy

SYNOPSIS

git-delete-tag [-r | --remote] [-f | --force] <tagname> [<tagname> ...]

PARAMETERS

-r, --remote
    Delete tag from remote repository (default: origin)

-f, --force
    Force deletion of annotated or protected tags

-l, --local
    Delete only from local repository (default if no -r)

<tagname>
    Name(s) of tag(s) to delete

DESCRIPTION

The git-delete-tag command provides a convenient way to remove tags from Git repositories. Tags mark specific commits, often for releases or milestones. While core Git uses git tag -d <tagname> for local deletion and git push origin --delete <tagname> for remotes, git-delete-tag simplifies this with unified syntax.

It supports local-only, remote-only, or both deletions, handling annotated and lightweight tags. Useful in CI/CD pipelines or maintenance scripts to clean up obsolete tags. Always verify tags with git tag -l before deletion, as it's irreversible without backups.

Typically invoked after fetching updates, it ensures repository hygiene by removing dangling references that clutter history views.

CAVEATS

Warning: Not a standard core Git command; often an alias, script, or from extensions like git-extras. Use git tag -d and git push --delete for portability. Deletions are permanent—backup refs/tags first. Fails if tag doesn't exist or lacks permissions.

EXAMPLES

Local delete: git-delete-tag v1.0.0
Remote delete: git-delete-tag -r v1.0.0
Multiple: git-delete-tag -r v1.*

EXIT CODES

0: Success
1: Tag not found or error
128: Git error

SEE ALSO

git tag(1), git push(1), git ls-remote(1)

Copied to clipboard