Tags mark specific points in history — usually releases.
Git has two kinds of tags:
- Lightweight: just a pointer to a commit (like a branch that doesn't move).
- Annotated: a full Git object with a tagger name, date, message, and optional GPG signature.
Use annotated tags for releases. Use lightweight tags for personal bookmarks.
git tag -a v1.0.0 -m "Release version 1.0.0"git tag v1.0.0-betagit tag -a v0.9.0 -m "Retroactive tag for beta" a1b2c3dgit tagv0.9.0
v1.0.0
v1.0.0-beta
git tag -l "v1.*"v1.0.0
v1.0.0-beta
git show v1.0.0tag v1.0.0
Tagger: Dariush Abbasi <dariush@example.com>
Date: Mon Mar 10 15:00:00 2025 +0330
Release version 1.0.0
commit e4f5a6b...
Tags are not pushed by default.
git push origin v1.0.0git push origin --tagsgit tag -d v1.0.0-betagit push origin --delete v1.0.0-betagit checkout v1.0.0Note: switching to 'v1.0.0'.
You are in 'detached HEAD' state.
🧠 What happened? You can look at the code as it was at v1.0.0, but you're in detached HEAD state. To make changes from here, create a branch: git switch -c hotfix/v1.0.1.