All commands

git tag

intermediate

Plant 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.

9a2f1c0init project4b7c2a5v1.0 candidatev1.0.0e1b5a09ship itmainHEAD

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.

1 / 2

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"
9a2f1c0init project4b7c2a5add componentsc86d9eestyle layoute1b5a09ship itmainHEAD

Time to pin this moment

Under the hood

1

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.

2

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.

3

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

git tag -a <name> -m "<msg>"
-a + -m

Annotated tag with a release message.

-s

Sign the tag with your GPG key (provenance!).

push origin --tags

Publish tags to the remote.

list

Show 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

Go deeper with