0
0
Gitdevops~20 mins

Pushing tags to remote in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tag Push 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 pushing a single tag to remote?
You have created a tag named v1.0 locally. You run the command git push origin v1.0. What will be the output?
Git
git push origin v1.0
AEverything up-to-date
Berror: src refspec v1.0 does not match any.
C
To origin
 * [new tag]         v1.0 -> v1.0
Dfatal: 'v1.0' does not appear to be a git repository
Attempts:
2 left
💡 Hint
Think about what happens when you push a specific tag name to the remote.
💻 Command Output
intermediate
2:00remaining
What happens when pushing all tags to remote?
You run git push origin --tags to push all tags. What is the expected output if there are two new tags v1.1 and v1.2?
Git
git push origin --tags
Afatal: remote origin not found
Berror: unknown option '--tags'
CEverything up-to-date
D
To origin
 * [new tag]         v1.1 -> v1.1
 * [new tag]         v1.2 -> v1.2
Attempts:
2 left
💡 Hint
The --tags option pushes all tags that are not yet on the remote.
Troubleshoot
advanced
2:00remaining
Why does pushing a tag fail with 'src refspec' error?
You run git push origin v2.0 but get the error: error: src refspec v2.0 does not match any. What is the most likely cause?
AThe tag v2.0 does not exist locally.
BThe remote repository is unreachable.
CYou forgot to add files before committing.
DThe branch v2.0 does not exist on remote.
Attempts:
2 left
💡 Hint
Check if the tag you want to push exists locally.
Best Practice
advanced
2:00remaining
Which command pushes tags but excludes annotated tags?
You want to push only lightweight tags to the remote, excluding annotated tags. Which command achieves this?
AThere is no built-in git command to push only lightweight tags
Bgit push origin refs/tags/*:refs/tags/* --no-annotated
Cgit push origin refs/tags/lightweight:*
Dgit push origin --tags
Attempts:
2 left
💡 Hint
Consider how git treats tags when pushing.
🔀 Workflow
expert
3:00remaining
Order the steps to push a new tag and verify it on remote
Arrange these steps in the correct order to create a tag named release-1.0, push it to remote, and verify it exists remotely.
A1,2,4,3
B4,1,2,3
C4,2,1,3
D1,4,2,3
Attempts:
2 left
💡 Hint
You must be on the right branch before tagging, then push, then verify.