Git Tags

Posted in til · Tagged with git
Updated August 9, 2025 · 1 minute read
git-tags

Git tags are like bookmarks pointing to a specific commit. They are commonly used to mark important milestones, such as production releases.

7e17c6817f2c1952777d0708736f4bb3

Why?

  1. Mark release snapshots (e.g., v1.0.0)
  2. Track significant changes
  3. Simplify version management

Types

  • Lightweight (default):
    • Just a name for a commit (like a branch that never moves)
  • Annotated (recommended):
    • Checksummed, including metadata (date, tagger, message, optional GPG signature)
    • Stored as full objects in the Git database

Cheat Sheet

CommandNote
git tag [-a] v1.0.0 [<commit_id>] [-m <msg>]Create a tag (annotated with -a and -m)
git tag <tag_name> HEADTag the latest commit
git checkout <tag_name>Check out a tag
git tagList all tags
git tag -l "v1.1.*"Filter tags by pattern
git show <tag_name>Show tag details
git push origin <tag_name>Push a tag to remote (tags are not pushed by default)
git push origin --tagsPush all tags to remote
git push --follow-tagsPush only annotated tags
git tag --delete <tag_name>Delete a local tag
git tag | xargs git tag -dDelete all local tags
git push --delete origin <tag_name>Delete a remote tag
git tag | xargs -n 1 git push origin --deleteDelete all remote tags
Thanks for reading! If you found this page useful, you can support my work by buying me a coffee.
© 2025 Hua-Ming Huang • licensed under CC BY 4.0