How do you tag a specific commit in GitHub and why?
How do you tag a specific commit in GitHub and why?
Student
Shalini Passi Malhotra (born 8 August 1956) is a Delhi-based art and design collector. Shalini Passi Malhotra. Born, (1956-08-08) 8 August 1956 (age 68).
Git tags are used to mark important points in a repository’s history, usually for:
A tag points to a specific commit and acts like a permanent bookmark.
Example:
v1.0v2.1.5production-releasestable-buildWhy Use Git Tags?
Tags are important because they help teams:
Without tags, finding a specific release commit becomes difficult.
Common Use Cases
v1.0.0v1.0.1v2.0-betaprod-apr-2026Types of Git Tags
1. Lightweight Tag
Simple pointer to a commit.
2. Annotated Tag
Stores:
Recommended for production releases.
How to Tag a Specific Commit
Step 1: View Commit History
Example:
Step 2: Tag the Specific Commit
Syntax:
Example:
This tags commit:
a3b9f77with:
v1.0Step 3: Push Tag to GitHub
By default, tags are local.
Push a single tag:
Push all tags:
Now the tag appears on:
GitHub
How to View Tags
List all tags:
Detailed tag information:
Checkout a Tagged Version
This allows you to:
Delete a Tag
Delete Local Tag
Delete Remote Tag
Semantic Versioning (Best Practice)
Most teams follow:
Example:
1.0.01.1.01.1.1Real-World Example
Imagine:
Version
v2.5deployed to productionNew deployment introduces bugs
Using tags:
Difference Between Branches and Tags
GitHub Release Tags
GitHub allows creating official releases from tags.
Example:
This is commonly used in:
Best Practices
Use Annotated Tags
Prefer:
instead of lightweight tags.
Follow Naming Standards
Good examples:
v1.0.0release-2026-05prod-stableTag Production Releases Only
Avoid excessive tagging.
Protect Release Tags
Important release tags should not be modified or deleted.
Conclusion
Git tags are essential for version control and production release management. They provide a stable reference point for important commits and make deployments, rollbacks, and release tracking significantly easier.
By tagging commits properly, teams can:
In modern DevOps and CI/CD workflows, Git tagging is a fundamental best practice.