AZ-400 · Question #530
AZ-400 Question #530: Real Exam Question with Answer & Explanation
The correct answer is B: git push origin v3.0.5. Explanation Creating and pushing a tag in Git requires exactly two steps: first, use git tag v3.0.5 (Option C) to create the tag locally on your current commit, and then use git push origin v3.0.5 (Option B) to explicitly push that specific tag to the remote repository - tags are
Question
You have a GitHub repository. You need to create a tag named v3.0.5 and ensure that the tag is available in the remote repository. Which two commands should you run? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.
Options
- Agit push -force
- Bgit push origin v3.0.5
- Cgit tag v3.0.5
- Dgit commit -m 'tag v3.0.5'
- Egit add 'tag v3.0.5'
Explanation
Explanation
Creating and pushing a tag in Git requires exactly two steps: first, use git tag v3.0.5 (Option C) to create the tag locally on your current commit, and then use git push origin v3.0.5 (Option B) to explicitly push that specific tag to the remote repository - tags are not pushed automatically with a regular git push.
Why the distractors are wrong:
- Option A (
git push -force) forces a push of commits but does not push tags, and using--forceis generally dangerous and irrelevant here. - Option D (
git commit -m 'tag v3.0.5') creates a commit, not a tag - these are entirely different Git objects. - Option E (
git add 'tag v3.0.5') stages files for a commit and has nothing to do with creating tags.
Memory Tip: Think of it as a two-step passport process - you must first create the tag locally (git tag) to "issue the passport," then present it at the border (git push origin <tagname>) to make it available remotely. Git never automatically sends your tags abroad!
Topics
Community Discussion
No community discussion yet for this question.