Git Tags & GitHub Releases
π‘ Intermediate
π Definition
A Git Tag is a reference pointer that marks a specific commit in history with a human-readable release version label (such as v1.0.0). A GitHub Release packages a Git Tag with formal changelog release notes and compiled binary assets for users to download.
π Multilingual Explanation
English
Git Tags mark software release milestones in commit history. Lightweight Tags are simple commit pointers. Annotated Tags (recommended) store tagger name, email, date, and a release message. Tags do not push to remotes automatically; you must explicitly run git push origin v1.0.0 or git push origin --tags.
Hindi
Git Tags aapke commit history mein release milestones (jaise v1.0.0, v2.0.0) mark karte hain. Annotated tags (git tag -a v1.0.0 -m "Release message") mein full author info aur release notes hote hain. Tags ko GitHub par upload karne ke liye git push origin --tags run karna zaroori hai.
Marathi
Git Tags cha vapar software releases (v1.0.0) mark karanyasathi hoto. Annotated tags (git tag -a) vaparne uttam aste. Tags GitHub var ghenyasathi git push origin --tags vaparatat.
Hinglish
Software versioning ke liye Semantic Versioning (vMAJOR.MINOR.PATCH e.g. v1.2.0) follow karein. Local tag banane ke baad git push origin --tags se GitHub par push karein, aur GitHub Releases tab par jaakar official release release notes ke sath publish karein.
π€ Why Do We Use Them?
Branches change constantly as new commits are added. Tags remain permanently fixed to a specific historical commit hash, allowing developers and deployment servers to instantly check out exact production release versions (v1.0.0).
π§ Simple Explanation
Think of commits like pages in a textbook:
- A Branch is a moving pencil bookmark showing where you are currently reading.
- A Tag is a permanent printed chapter marker stuck to Page 100 labeled βChapter 1: Initial Releaseβ. No matter how many pages are added later, Page 100 remains tagged as Chapter 1.
π Semantic Versioning (SemVer) Standard
Industry release version numbers follow the vMAJOR.MINOR.PATCH format:
v 2 . 4 . 1
β β βββ PATCH: Backward-compatible bug fixes
β βββββββ MINOR: Backward-compatible new features
βββββββββββ MAJOR: Breaking changes / Incompatible API updates
π‘ Key Tagging Commands
1. Creating Annotated Tags (RECOMMENDED)
# Create an annotated tag on current HEAD commit
git tag -a v1.0.0 -m "Production Release Version 1.0.0"
# Tag a past specific commit SHA
git tag -a v0.9.0 a1b2c3d -m "Beta release"
2. Listing & Inspecting Tags
# List all tags
git tag
# Filter tags matching pattern
git tag -l "v1.*"
# Inspect detailed tag info and matching commit details
git show v1.0.0
3. Pushing Tags to GitHub Remote
Tags are NOT pushed automatically by git push! You must push tags explicitly:
# Push a single specific tag
git push origin v1.0.0
# Push ALL local tags to GitHub at once
git push origin --tags
4. Deleting Tags
# Delete local tag
git tag -d v1.0.0
# Delete remote tag on GitHub
git push origin --delete v1.0.0
π Publishing a GitHub Release
- Navigate to your GitHub repository web page -> Click Releases (right sidebar).
- Click Draft a new release.
- Select an existing tag (e.g.
v1.0.0) or create a new tag. - Add Release Title and detailed Markdown changelog release notes.
- (Optional) Drag and drop compiled executable binaries (
.zip,.exe,.apk). - Click Publish release.
π GitHub Release View
Release v1.0.0: Production Release [Latest]
Tag: v1.0.0 | Published 5 minutes ago by @Rahul
Changelog:
- Added responsive navbar layout
- Fixed authentication session timeout bug
Assets:
π¦ Source code (zip)
π¦ Source code (tar.gz)
β οΈ Common Mistakes
- Forgetting to Push Tags: Creating local tags with
git tag -a v1.0.0and expecting them to show up on GitHub automatically without runninggit push origin --tags. - Using Lightweight Tags for Official Releases: Using
git tag v1.0.0(lightweight tag lacking author/date metadata) instead of annotated tags (git tag -a v1.0.0 -m "msg").
π‘οΈ Safety / Important Notes
- Annotated tags are stored as full objects in the Git database, checksummed with SHA hashes containing tagger name, email, date, and message payload.
π Real-World Usage
Software deployment pipelines (Jenkins, GitHub Actions, Docker) trigger automated production server deployments whenever a new version tag (e.g., v1.*) is pushed to GitHub.
π§ͺ Try It Yourself
- Inside your
git-practicerepo, create an annotated tag on your latest commit:git tag -a v1.0.0 -m "Initial Release v1.0.0". - Run
git tagto list your tags. - Run
git show v1.0.0to inspect tag metadata.
π― Mini Challenge
Push your tag to GitHub using git push origin v1.0.0 (or git push origin --tags), open your repo on GitHub web, and navigate to the Releases tab to view your live tag!
π Related Topics
π§ Navigation
| β Home | β Previous: GitHub Pages | Next: GitHub Actions β |