Script Valley
Git and GitHub Complete Course: From Beginner to Advanced
Intermediate Git: Stashing, Tagging, Reverting, and ResettingLesson 4.2

Tagging Releases

git tag, lightweight tag, annotated tag, semantic versioning, pushing tags, deleting tags

Tagging Releases

Tags are references that point to specific commits and do not move as new commits are added. They are used to mark release points like v1.0.0 or v2.3.1, making it easy to check out a specific version at any time.

DiagramSemantic Versioning and Git Tags

IMAGE PROMPT (replace this block with your generated image):

Flat two-part diagram on white background. Title: Git Tags and Semantic Versioning. Top part: Semver breakdown card. Large version string v 2 . 4 . 1 displayed prominently. Each segment color-coded and labeled below: 2 = MAJOR (red badge) — Breaking changes. 4 = MINOR (amber badge) — New features, backward compatible. 1 = PATCH (#3A5EFF badge) — Bug fixes only. Bottom part: a horizontal commit timeline C1 → C2 → C3 → C4 → C5. Tag markers pointing down from commits: v1.0.0 at C2 (lightweight tag, dashed border), v1.1.0 at C3 (annotated tag, solid #3A5EFF border with metadata card: tagger, date, message). v1.1.1 at C5 (annotated, solid border). Annotated tag metadata card shows: Tag: v1.1.0, Tagger: Alice, Date: 2024-01-15, Message: Release version 1.1.0. Command badges: git tag -a v1.0.0 -m "..." and git push origin --tags. White background, brand color #3A5EFF for annotated tags.

Lightweight Tags

A lightweight tag is just a name pointing to a commit — like a branch that never moves:

git tag v1.0.0

Annotated Tags

Annotated tags store extra metadata: tagger name, email, date, and a message. They are recommended for releases because they are proper objects in the Git database:

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

Semantic Versioning

Semantic versioning (semver) uses the format MAJOR.MINOR.PATCH. Increment MAJOR for breaking changes, MINOR for new backwards-compatible features, and PATCH for backwards-compatible bug fixes. Tags like v1.2.3 follow this standard.

Listing and Viewing Tags

git tag
git show v1.0.0

Pushing Tags to Remote

Tags are not pushed automatically with git push. Push a specific tag or all tags:

git push origin v1.0.0
git push origin --tags

Deleting Tags

git tag -d v1.0.0-beta
git push origin --delete v1.0.0-beta

Up next

Undoing Changes: git revert

Sign in to track progress