Which statement correctly describes the difference between a lightweight tag and an annotated tag in Git?
Think about what extra information an annotated tag holds compared to a lightweight tag.
Lightweight tags are just simple references to commits without extra information. Annotated tags include metadata such as the tagger's name, email, date, and a message, making them more informative.
What is the output of the following command if executed successfully in a Git repository?
git tag v1.0
Consider what happens when you create a tag without the -a option.
Running git tag v1.0 creates a lightweight tag silently without any output. Annotated tags require the -a option and a message.
What is the output of this command in a repository with annotated and lightweight tags?
git show v1.0
Assume v1.0 is an annotated tag with a message and v1.1 is a lightweight tag.
Remember what information an annotated tag contains and what git show displays.
git show on an annotated tag displays the tag's metadata (message, tagger info) plus the commit details. Lightweight tags have no metadata, so only commit info is shown.
You want to push all your tags to the remote repository. Which command ensures both lightweight and annotated tags are pushed?
Consider the command that pushes all tags regardless of type.
git push origin --tags pushes all tags, both lightweight and annotated, to the remote. --all pushes all branches, not tags.
You created a lightweight tag v1.0 locally but when you run git push origin v1.0, it fails with an error. What is the most likely reason?
Think about how Git references tags when pushing them individually.
When pushing a single tag, Git expects the full ref name refs/tags/v1.0. Without it, pushing a lightweight tag may fail. Annotated tags often push fine by name because of metadata handling.