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.

Aliases the pros type

Memorize the git tag concept, then let one of these shortcuts make it instant. Aliases are real git config keys — add one with:

git config --global alias.st # → git tag -a -m
AliasWhy people use it
g tg

Annotated tag with message in one alias.

g tgp

Publish your tags alongside the branch push.

g tgl

List all tags quickly.

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.

Pro tip

`git describe` reads the nearest tag a commit is downstream of — it's how many tools (and git itself) produce human-ish version strings like v1.2.0-4-g8a9f7c1 (4 commits after v1.2.0).

Go deeper with