Lightweight or annotated. Releases live here.
Mark a specific commit with a name. Two flavors: lightweight (just a ref pointing at a commit, like a branch that doesn't move) and annotated (a real tag object with author, message, optional GPG signature — what you want for releases).
A lightweight tag is refs/tags/<name> containing a commit SHA. An annotated tag is refs/tags/<name> containing a tag object SHA, where the tag object then references the commit. Annotated tags are searchable by git describe, signable, and have their own metadata.
git tag [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>] [-e]
<tagname> [<commit> | <object>]
git tag -d <tagname>...
git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
[--points-at <object>] [--column[=<options>] | --no-column]
[--create-reflog] [--sort=<key>] [--format=<format>]
[--merged <commit>] [--no-merged <commit>] [<pattern>...]
git tag -v [--format=<format>] <tagname>...| Flag | What it does |
|---|---|
-a, --annotate | Make an annotated tag. |
-m "<msg>" | Tag message (implies -a). |
-s, --sign | GPG-sign the tag. |
-d, --delete | Delete a tag. |
-l <pattern> | List tags matching <pattern>. |
--points-at <commit> | List tags pointing at <commit>. |
-f, --force | Replace an existing tag of the same name. |
$ git tag v1.2$ git tag -a v1.2 -m 'release 1.2 — purple theme'$ git tag -s v1.2 -m 'release 1.2'git push by default).$ git push origin v1.2
$ git push --tags # all of them-a) for anything you'd ever cut a release from. Lightweight tags are fine for personal scratchpads.vMAJOR.MINOR.PATCH) and stick to it — git describe becomes a useful version oracle.git rev-parse v1.2 may surprise you.Hit each option, then Check answers. Score is recorded; Next is always open.