What is the difference between lightweight and annotated Git tags?
Quick answer
A lightweight tag is a name pointing directly to a Git object, usually a commit. An annotated tag adds a separate tag object containing a tagger, date, and message; it can also include a cryptographic signature. Both are tags, not branch names. Use a lightweight tag for a simple local marker and an annotated tag when you want the tag itself to carry release information. [S1]
The question, the details, the next step.
A practical checklist
Decide whether a simple object reference is enough.
Use
git tag NAMEfor a lightweight tag by default.Use
git tag -a NAME -m "MESSAGE"when you want an annotated tag message.Consider whether tagger details, date, or an optional signature matter.
Check that you mean to create a tag, not a branch.
A few more useful answers
Does a lightweight tag have a tag message?
A lightweight tag points directly to an object; the separate message-bearing tag object is characteristic of an annotated tag. [S1]
Is an annotated tag a branch?
No. Git treats tags and branches as separate kinds of references. [S1]
Does the annotated-tag command always create an unsigned tag?
Not necessarily: signing configuration can affect behavior. The documented command example creates an annotated tag absent configuration that changes signing behavior. [S1]
Sources
References used for this guide.
- [S1] Git Reference: git-tag git-scm.com · Checked
