0
0
Gitdevops~20 mins

Lightweight vs annotated tags in Git - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tag Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference between lightweight and annotated tags

Which statement correctly describes the difference between a lightweight tag and an annotated tag in Git?

ABoth lightweight and annotated tags store the same metadata, but only annotated tags can be pushed to remote repositories.
BA lightweight tag is just a pointer to a commit, while an annotated tag stores extra metadata like the tagger's name, email, and date.
CAn annotated tag is a simple pointer to a commit, while a lightweight tag stores metadata and a message.
DA lightweight tag stores the tagger's signature, but an annotated tag does not.
Attempts:
2 left
💡 Hint

Think about what extra information an annotated tag holds compared to a lightweight tag.

💻 Command Output
intermediate
1:30remaining
Output of creating a lightweight tag

What is the output of the following command if executed successfully in a Git repository?

git tag v1.0
ANo output is shown; the tag 'v1.0' is created as a lightweight tag.
BError: tag name 'v1.0' is invalid.
CCreated annotated tag 'v1.0' with message 'v1.0'.
DWarning: You must provide a message for the tag.
Attempts:
2 left
💡 Hint

Consider what happens when you create a tag without the -a option.

💻 Command Output
advanced
2:00remaining
Output of listing tags with details

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.

AShows the tag message, tagger info, and commit details for 'v1.0'.
BShows only the tag message without commit details.
CShows an error because 'v1.0' is a lightweight tag.
DShows only the commit details without tag metadata for 'v1.0'.
Attempts:
2 left
💡 Hint

Remember what information an annotated tag contains and what git show displays.

🔀 Workflow
advanced
1:30remaining
Pushing annotated vs lightweight tags to remote

You want to push all your tags to the remote repository. Which command ensures both lightweight and annotated tags are pushed?

Agit push origin --annotated-tags
Bgit push origin v1.0
Cgit push origin --all
Dgit push origin --tags
Attempts:
2 left
💡 Hint

Consider the command that pushes all tags regardless of type.

Troubleshoot
expert
2:30remaining
Why does 'git push origin v1.0' fail for a lightweight tag?

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?

AThe tag <code>v1.0</code> does not exist locally.
BLightweight tags cannot be pushed individually; only annotated tags can.
CYou need to specify <code>refs/tags/v1.0</code> explicitly to push a lightweight tag.
DThe remote repository does not accept pushing lightweight tags by default.
Attempts:
2 left
💡 Hint

Think about how Git references tags when pushing them individually.