git tag
intermediatePlant a permanent, named marker on a commit.
What it does
git tag creates an immutable name pointing at a specific commit — v1.0.0, v2.3.1 — a release anchor that branches are free to move away from. Lightweight tags are just a ref file with a hash; annotated tags are full objects with message, tagger and date.
A tag pins a commit forever, indifferent to branch movement
Watch it — press play
A narrated, step-by-step walkthrough that shows how to do it — not just theory. It adapts to the learner mode you picked in the top bar.
Step 1
Freeze a milestone
You shipped v1.0.0. A branch would drift — you need a name that never moves.
git tag -a v1.0.0 -m "production release"Time to pin this moment
Under the hood
Lightweight: a ref that never moves
`git tag v1.0.0` writes a file refs/tags/v1.0.0 containing a commit hash. Same mechanism as a branch, minus the movement: tags are not updated by any commit.
Annotated: a full tag object
`git tag -a v1.0.0 -m "release"` creates a TAG OBJECT (type tag) that holds tagger, message, date, and points to the commit. The ref then points at the tag object — richer, cryptographically signed (git tag -s) metadata.
Tags move with clones if you push them
Tags aren't pushed by default with the branch push. `git push --follow-tags` (or --tags) ships them. Cloning brings every reachable tag, so releases travel with the repo.
Command anatomy
-a + -mAnnotated tag with a release message.
-sSign the tag with your GPG key (provenance!).
push origin --tagsPublish tags to the remote.
listShow all tags, lexically ordered.
When to reach for it
Marking releases: v1.0.0, v2.1.3 — the only true immovable milestones.
Rollback anchors: git checkout v1.2.0 to run a released state.
The npm/package.json version bump paired with a matching tag.
Practice
A real repo, pre-seeded with history, runs right here — stage, commit, branch, stash, diff, even hit and resolve a real merge conflict. Nothing to install, nothing leaves your machine.
Open practice playground