Last Updated: May 1, 2025
Tag Commands
git tagList all tags alphabetically
git tag -l 'v2.*'List tags matching a pattern (use wildcards)
git tag v1.0.0Create a lightweight tag at current HEAD
git tag -a v1.0.0 -m Release messageCreate an annotated tag with message
git tag -a v1.0.0 commit -m msgTag a specific commit (not HEAD)
git show v1.0.0Show full tag details: tagger, date, message, commit
git tag -d v1.0.0Delete a local tag
git push origin --delete v1.0.0Delete a remote tag
Pushing & Sharing Tags
git push origin v1.0.0Push a single tag to remote
git push origin --tagsPush ALL local tags to remote
git push --follow-tagsPush commits AND any annotated tags that reference them
git fetch --tagsFetch all tags from remote
git tag -l --sort=-creatordateList tags sorted by creation date (newest first)
git tag -l --sort=-version:refnameSort tags semantically (v2.0 after v1.10)
git ls-remote --tags originList all tags on remote without fetching
git push origin :refs/tags/v1.0.0Alternative syntax to delete a remote tag
Checking Out Tags
git checkout v1.0.0Check out a tag (you'll be in detached HEAD state)
git checkout -b branch-from-tag v1.0.0Create a branch from a tag (safer)
git switch --detach v1.0.0Detach HEAD at a specific tag
git describe --tagsShow the most recent tag reachable from HEAD
git describe --tags --abbrev=0Show only the tag name, no commit suffix
git describe --tags --dirtyAppend '-dirty' if working tree has changes
Signed Tags (GPG)
git tag -s v1.0.0 -m ReleaseCreate a GPG-signed tag
git tag -v v1.0.0Verify a signed tag's GPG signature
git config --global user.signingkey KEYIDSet default GPG key for signing
git tag -a --sign v1.0.0 -m ReleaseCreate annotated AND signed tag
git config --global tag.gpgSign trueSign all tags automatically
gpg --list-secret-keys --keyid-format LONGFind your GPG key ID
Pro Tip: Always use annotated tags for releases (`git tag -a`). They store the tagger, date, and message — lightweight tags are just pointers.