Types of tags in git
Table of Contents
A tag is a name for a commit. git has two kinds:
- Lightweight tags: just a name that points at a commit.
- Annotated tags: a name that points at a tag object, which stores who created the tag, when, and why. The tag object then points at the commit.
Lightweight: nightly ─────────────────────▶ commit C
Annotated: v1 ──▶ tag object ───────────▶ commit B
tagger: Jane Doe
date: 2026-01-01
message: Release v1
1. Lightweight tags
$ git tag nightly C
A lightweight tag is like a branch that never moves. It stores nothing except the commit it points at.
2. Annotated tags
$ git tag -a v1 -m "Release v1" B
An annotated tag creates a new object in the repository, just like a commit does.
3. Why two kinds?
They are meant for different jobs.
Annotated tags are for releases. A release is a public statement: "this commit is version 1". People who use the release want to know:
- Who made the release. The tagger is stored.
- When it was released. The tag date is when the release was made. The commit date may be much older.
- Why. The message can hold release notes.
Lightweight tags are for personal or temporary markers. Sometimes you only want a quick bookmark, for example:
- "the commit I tested last night" (
nightly) - "before I started this risky rebase" (
before-rebase)
You don't need a tagger, a date or a message for that.
Some of git's tools treat annotated tags as the 'real' ones and skip lightweight tags unless you ask for them.
| Command | Annotated | Lightweight |
|---|---|---|
git describe |
Used | Only with --tags |
git push --follow-tags |
Pushed | Not pushed |
git show <tag> |
Shows the tag message, then the commit | Shows only the commit |
Use git cat-file -t <tag> to see which kind a tag is. It prints tag for an
annotated tag and commit for a lightweight one.