Skip to main content
Tagging & Releases

git tag

Mark specific commits as named releases

Practical Example

git tag -a v1.0.0 -m "Initial public release"
git push origin v1.0.0
git tag -n                     # list tags with annotations

Command Overview & How It Works

Tags are named references to specific commits, typically used to mark release versions (v1.0.0, v2.3.1-beta). There are two types: lightweight tags (just a name pointing to a commit) and annotated tags (stored as full objects with a message, author, and date). Use git tag -a v1.0.0 -m "Release 1.0.0" to create an annotated tag — recommended for releases because they include metadata. List tags with git tag (all), git tag -l "v1.*" (by pattern), or git tag -n (with annotation messages). Push tags to a remote with git push origin v1.0.0 or git push origin --tags (all tags). Delete a local tag with git tag -d v1.0.0 and a remote tag with git push origin :refs/tags/v1.0.0. Tags are not automatically included in git push — you must push them explicitly.

Practical Tips

  • Use annotated tags (git tag -a v1.0.0 -m '...') for releases — they store the tagger, date, and a message.
  • Tags are not pushed automatically: push them explicitly with git push origin v1.0.0 or git push origin --tags.
  • Tag a past commit by including its hash: git tag -a v1.0.0 <hash>.

Related Commands in Tagging & Releases