BeginnerPhone
2 min
Annotated vs Lightweight Git Tags
GitVersion ControlRelease Engineering
Advertisement
Interview Question
What is the difference between an annotated tag and a lightweight tag in Git, and when would you choose each?
Key Points to Cover
- Annotated tags are full objects with metadata/signature; lightweight are pointers to a commit
- Annotated preferred for releases (authors, messages, signing)
- Lightweight for quick local markers or temporary refs
Evaluation Rubric
Defines annotated tags and benefits40% weight
Defines lightweight tags and use30% weight
Provides correct selection guidance30% weight
Hints
- 💡Mention `-a`, `-s`, and `git describe`.
Common Pitfalls to Avoid
- ⚠️Using lightweight tags for official releases or shared milestones, which omits critical metadata and the ability to verify authenticity.
- ⚠️Forgetting to push tags: Tags (especially annotated ones) are not automatically pushed with `git push` by default; `git push --tags` is often required.
- ⚠️Creating annotated tags but providing generic or empty messages, negating the benefit of their rich metadata.
- ⚠️Confusing the static nature of lightweight tags with the movable nature of branches, leading to misunderstandings about version history.
- ⚠️Over-tagging or using annotated tags for every minor commit, which can clutter the repository and add unnecessary overhead for local markers.
Potential Follow-up Questions
- ❓How do you push tags to remote?
- ❓How to delete a remote tag?
Advertisement