git tag
Creates, lists, deletes, or verifies tags. Tags mark specific points in a repository's history, typically used for releases.
Syntax
git tag [<options>] [<tagname>] [<commit>]
Options
- -a / --annotate: Creates an annotated tag (with metadata and message)
- -m <message>: Specifies the tag message for annotated tags
- -d / --delete: Deletes a tag
- -l / --list [<pattern>]: Lists tags matching an optional glob pattern
- -f / --force: Replaces an existing tag
- -n <num>: Shows <num> lines of the tag message
- --sort=<key>: Sorts tags by the given key (e.g., version:refname)
Example
git tag v1.0.0 git tag -a v1.0.0 -m "Release 1.0.0" git tag -l "v1.*" git tag -d v0.9.0
Tip
Use annotated tags (-a) for releases; they include the tagger, date, and message.