Progress:
TIER 1 · MODULE 18· Basics

git tag

Lightweight or annotated. Releases live here.

🎯 What & why

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).

🧠 Mental model

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.

🛠️ Synopsis

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>...

🎚️ Switches & options

FlagWhat it does
-a, --annotateMake an annotated tag.
-m "<msg>"Tag message (implies -a).
-s, --signGPG-sign the tag.
-d, --deleteDelete a tag.
-l <pattern>List tags matching <pattern>.
--points-at <commit>List tags pointing at <commit>.
-f, --forceReplace an existing tag of the same name.

💡 Use cases

🧪 Examples

Lightweight tag at HEAD.
$ git tag v1.2
Annotated tag — what you want for a release.
$ git tag -a v1.2 -m 'release 1.2 — purple theme'
Signed tag.
$ git tag -s v1.2 -m 'release 1.2'
Push tags (they don't go with git push by default).
$ git push origin v1.2
$ git push --tags  # all of them

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.