🏷️ Remember That Special Commit
Commit hashes are unmemorable. Tags give meaningful names. v1.0.0, release-candidate, hotfix-2. Easy to reference, easy to deploy.
📝 Create Tags
# Lightweight tag (just pointer) git tag v1.0.0 # Annotated tag (includes author, date, message) git tag -a v1.0.0 -m "Release version 1.0.0" # Tag previous commit git tag v0.9.0 a1b2c3d # Tag with GPG signature git tag -s v1.0.0 -m "Signed release" # List tags git tag git tag -l "v1.*" # Show tag details git show v1.0.0
🎯 Push and Delete Tags
# Push single tag git push origin v1.0.0 # Push all tags git push --tags # Delete local tag git tag -d v1.0.0 # Delete remote tag git push origin --delete v1.0.0 # Checkout tag (detached HEAD) git checkout v1.0.0 # Create branch from tag git checkout -b hotfix-branch v1.0.0
💡 Use Cases
- Release versions (v1.0.0, v2.1.3)
- Deployment checkpoints
- Customer-specific builds
- Hotfix markers
- Milestone commits (sprint-1, prototype)
“Remembering commit hash for deployment was error-prone. git tag v1.0.0, then git push –tags. Deployment now uses tag. Simple and reliable.”
