🏷️ TagsCommonly used

How to create a tag in Git

Mark a specific commit as a release or milestone.

Create an annotated tag (recommended)
git tag -a v1.0.0 -m "Version 1.0.0"

Creates an annotated tag with a message, author and date. Preferred for releases.

When to use: For versioned releases. Annotated tags have more metadata than lightweight tags.

Create a lightweight tag
git tag v1.0.0

Creates a simple pointer to a commit with no extra metadata.

When to use: For temporary or private use. Not recommended for releases.

Tag a specific commit
git tag -a v1.0.0 abc1234 -m "Version 1.0.0"

Tags a specific past commit by hash.

When to use: You forgot to tag at the time of release.

← Back to Git Reference