Git & GitHub Interview Question #62
What is the difference between lightweight and annotated tags?
Undo & Recovery, Tags, Forks, Pull Requests & Code Review Mid-Level Intermediate
Quick Interview Answer
A lightweight tag is essentially a simple name pointing to a commit. An annotated tag is a full Git object that can include a tagger, date, message, and optional cryptographic signature.
Detailed Explanation
A lightweight tag is essentially a simple name pointing to a commit. An annotated tag is a full Git object that can include a tagger, date, message, and optional cryptographic signature.
Annotated tags are commonly preferred for formal releases because they contain additional metadata. Lightweight tags can be convenient for temporary or simple markers.
Code Example
# Lightweight
git tag v1.0.0
# Annotated
git tag -a v1.1.0 -m "Release version 1.1.0"