history

git tag

Marks specific commits with a permanent name, typically for release versions like v1.2.0. Supports lightweight tags (a ref) or annotated tags (a full object with metadata).

git tag [<options>] [<tagname> [<commit>]]

Common flags

Flag Purpose
-a <name> Create an annotated tag with author, date, and message
-m <msg> Message for annotated or signed tags
-s Create a GPG-signed tag
-d <name> Delete a local tag
-l <pattern> List tags matching a glob pattern
-f Force overwrite an existing tag

Examples

git tag -a v1.0.0 -m "Release 1.0"

Create an annotated release tag

git push origin v1.0.0

Publish a single tag to origin

git tag -l "v1.*"

List all v1.x tags

Gotcha

Tags are NOT pushed by default; use 'git push --tags' or push each tag by name to make releases visible on the remote.

Related commands

← All Git commands · Git cheat sheet · Git rebase vs merge