Skip to content
Latchkey

git tag -a / -d: Usage, Options & Common CI Errors

git tag -a creates an annotated release tag; git tag -d removes a tag from your local repo.

Annotated tags carry an author, date, message, and optional signature - the right choice for releases. Deletion is local only; the remote tag needs a separate push to remove.

What it does

git tag -a creates an annotated tag object (stored with tagger, date, and message), unlike a lightweight tag which is just a pointer. git tag -d removes the named tag from the local repository.

Common usage

Terminal
git tag -a v1.2.0 -m "Release 1.2.0"
git tag -a v1.2.0 <sha> -m "Release"     # tag a specific commit
git tag -d v1.2.0                         # delete locally
git push origin v1.2.0                    # publish the tag
git push origin :refs/tags/v1.2.0         # delete on the remote

Options

FlagWhat it does
-a / --annotateCreate an annotated tag
-m <msg>Tag message (implies annotated)
-s / --signGPG-sign the tag
-d / --deleteDelete a tag locally
-f / --forceMove an existing tag

Common errors in CI

fatal: tag 'vX' already exists - re-tagging needs -f locally and git push --force origin vX (or delete-then-push) on the remote. Deleting locally with -d does not remove the remote tag; push the :refs/tags/<name> deletion explicitly.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →