Tagging Milestones and Software Releases with git tag
Tagging Milestones and Software Releases with git tag
In software engineering, development moves continuously, but users and deployments interact with specific milestones: v1.0.0, v2.1.4-beta, etc. Git provides tags to mark specific points in repository history as important release milestones.
1. What is a Git Tag?
While a branch is a moving pointer that advances every time you make a commit, a tag is an immutable, permanent snapshot pointer. Once placed on a commit, a tag never moves.
2. The Two Types of Git Tags
Git supports two distinct types of tags:
| Attribute | Lightweight Tag | Annotated Tag (Recommended) |
|---|---|---|
| What is it? | Just a simple bookmark pointer to a commit hash | A full Git object stored in the database with checksum |
| Metadata | None | Stores tagger name, email, timestamp, and release message |
| GPG Signing | Cannot be cryptographically signed | Can be signed with GPG keys for verified releases |
| Use Case | Quick local private bookmarks | Official software versions, production deployments |
3. Creating and Managing Tags
A. Creating an Annotated Tag (-a)
Always use annotated tags for official releases:
B. Creating a Lightweight Tag
C. Tagging a Past Commit
You don't have to be standing on a commit to tag it; just provide its hash:
D. Listing All Tags
E. Viewing Tag Metadata (git show)
Output:
4. Pushing Tags to GitHub
git push does NOT transfer tags to remote servers! You must explicitly push tags:Releases on GitHub:
When you push tags like v1.0.0 to GitHub, GitHub automatically:
- 1Surfaces them under the Releases / Tags tab.
- 2Bundles the codebase into downloadable
.zipand.tar.gzsource code archives. - 3Allows maintainers to attach compiled binaries, release notes, and changelogs.
Deleting a Tag:
Practice Quiz
git tag -a) preferred over Lightweight Tags for official releases?git push origin main, are your newly created local tags automatically pushed to GitHub?v1.2.0 from GitHub?Crafting a Professional README.md with Badges, Demos & Markdown
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Related Lessons
Practice Quiz
Test your understanding of this lesson with 5 questions. Each question has one correct answer.