Skip to main content

Tags and Releases

Level: Intermediate

ℹ️ What You'll Learn
  • Create version tags
  • Lightweight vs annotated tags
  • Tag for releases
  • Push tags
  • Checkout specific version

Create Tag

Lightweight:

git tag v1.0.0

Annotated (recommended):

git tag -a v1.0.0 -m "Release version 1.0.0"

Annotated stores: who tagged, when, message.

List Tags

git tag -l
# v0.1.0
# v0.2.0
# v1.0.0

git tag -l "v1.*"
# v1.0.0

Push Tags

git push origin v1.0.0

# Push all tags
git push origin --tags

Checkout Specific Version

git checkout v1.0.0
# Detached HEAD state - read-only

git checkout -b release-1.0
# Create branch from tag

SMS Versioning

# v0.1.0 - Student module
git tag -a v0.1.0 -m "Add student management"

# v0.2.0 - Exam module
git tag -a v0.2.0 -m "Add exam management"

# v1.0.0 - Complete SMS
git tag -a v1.0.0 -m "Release SMS v1.0.0"

Semantic Versioning: MAJOR.MINOR.PATCH

Tag Specific Commit

git tag -a v0.1.0 abc123 -m "Hotfix for v0.1"
# Tag past commit

Delete Tag

git tag -d v0.1.0
# Local delete

git push origin --delete v0.1.0
# Remote delete

Key Takeaways

  • Tag = milestone/version
  • Release = tagged version deployed
  • Semantic versioning = major.minor.patch
  • Checkout tag = get specific version
💡 Tagging Strategy

Tag every release. Use semantic versioning. Push tags to server.

🤖Use AI to Learn Faster

Use ChatGPT, Claude, or Copilot to go deeper on Git Tags. Try these prompts:

  • "When should I create a tag?"
  • "What's semantic versioning?"
  • "How do I checkout a specific version?"
  • "Quiz me on tags"

💡 Tip: After reading this article, paste your own code into AI and ask "What could go wrong here and why?" — fastest way to find edge cases and deepen understanding.

nexcoding.in