π·οΈ Tags = Version Releases
Commits are many. Tags mark releases. Version 1.0, v2.3.4 β memorable, searchable, deployable.
π Tag Commands
# List tags git tag git tag -l "v*" # Lightweight tag git tag v1.0.0 # Annotated tag (with message) git tag -a v1.0.0 -m "Release version 1.0.0" # Tag specific commit git tag -a v1.0.0 commit-hash # Show tag details git show v1.0.0 # Push tags to remote git push origin v1.0.0 git push origin --tags # All tags # Delete local tag git tag -d v1.0.0 # Delete remote tag git push origin --delete v1.0.0 # Checkout tag git checkout v1.0.0 git checkout -b release/v1.0.0 # Semantic Versioning (SemVer) v1.0.0 # Major.Minor.Patch v1.0.1 # Bug fix v1.1.0 # Minor feature v2.0.0 # Breaking change
π― Versioning Strategies
# Release Workflow
git checkout main
git pull origin main
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0
# Build from tag
git checkout v1.0.0
docker build -t myapp:1.0.0 .
docker push myapp:1.0.0
# Deploy from tag
kubectl set image deployment/myapp myapp=myapp:1.0.0
# Hotfix workflow
git checkout main
git checkout -b hotfix/critical-bug
# Fix bug
git commit -m "Fix critical bug"
git checkout main
git merge hotfix/critical-bug
git tag -a v1.0.1 -m "Hotfix v1.0.1"
git push origin v1.0.1
# CI/CD with tags
# GitHub Actions
on:
push:
tags:
- 'v*'
# Tag Best Practices
- Use annotated tags (with message)
- Follow SemVer for versioning
- Tag every release
- Push tags to remote
- Use tags for deployment
π‘ Tag Tips
- Use annotated tags (with message)
- Follow SemVer for versioning
- Tag every release
- Push tags to remote
- Use tags for deployment
“Tags mark releases. Version tracking, deployment. Essential for software delivery.”
