0
0
Gitdevops~20 mins

Tagging specific commits in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Tagging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this git tag command?
You run the command git tag -a v1.0 9fceb02 -m "Release version 1.0". What does this command do?
Git
git tag -a v1.0 9fceb02 -m "Release version 1.0"
ACreates a lightweight tag named 'v1.0' on the latest commit with the message 'Release version 1.0'.
BCreates an annotated tag named 'v1.0' on commit '9fceb02' with the message 'Release version 1.0'.
CDeletes the tag 'v1.0' from commit '9fceb02'.
DLists all tags that contain the message 'Release version 1.0'.
Attempts:
2 left
💡 Hint
The '-a' option creates an annotated tag, and '-m' adds a message.
🧠 Conceptual
intermediate
1:30remaining
Which git command shows the commit a tag points to?
You want to see the commit hash that a tag named 'v2.0' points to. Which command will show this?
Agit checkout v2.0
Bgit log v2.0 --oneline
Cgit show v2.0
Dgit tag -l v2.0
Attempts:
2 left
💡 Hint
One command shows tag details including the commit.
Troubleshoot
advanced
2:00remaining
Why does this tag command fail?
You run git tag -a v3.0 abc1234 -m "Version 3.0" but get an error: fatal: Not a valid object name abc1234. What is the likely cause?
Git
git tag -a v3.0 abc1234 -m "Version 3.0"
AThe commit hash 'abc1234' does not exist in the repository.
BThe tag name 'v3.0' is already used for another tag.
CThe message flag '-m' cannot be used with '-a'.
DYou need to add '--force' to overwrite existing tags.
Attempts:
2 left
💡 Hint
Check if the commit hash exists in your repo.
🔀 Workflow
advanced
1:30remaining
How to push a specific tag to remote?
You created a tag 'release-1.1' locally. Which command pushes only this tag to the remote repository?
Agit push --all origin
Bgit push origin --tags
Cgit push origin HEAD
Dgit push origin release-1.1
Attempts:
2 left
💡 Hint
Pushing all tags uses a different flag.
Best Practice
expert
2:30remaining
What is the best practice for tagging a release commit?
You want to tag a release commit so that it includes metadata like author, date, and a message. Which tag type should you use?
AAnnotated tag
BSigned tag without message
CLightweight tag
DTemporary tag
Attempts:
2 left
💡 Hint
One tag type stores extra information and is recommended for releases.