Creating and Publishing Tag v3.0.5 with git tag and git push origin v3.0.5
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.
Community Votes
100% of anonymous learners picked answer BC. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
git tag creates the tag in the local repository only, and git push origin v3.0.5 transfers that specific ref to the remote, so the tag becomes visible remotely only after the push.
A tag named v3.0.5 must be created in a GitHub repository and made available in the remote repository. A tag only exists locally after it is created, so a second step is required to publish it so the remote repository contains it.
Using git push -force, which overwrites remote history and is both unnecessary and risky here, since a newly created tag does not conflict with anything and simply needs to be pushed.
Community Discussion (4 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Two distinct actions are needed because a Git tag lives in two places. The first is creating the tag at the current commit locally, which is what git tag v3.0.5 does, naming it so it can be referenced. The second is transferring that ref to the remote repository, which is what git push origin v3.0.5 does with the explicit tag name as the refspec. Only after the push does the tag exist in the remote repository and become available to other clones. The vote was unanimous at 100 for B and C, and UrbanRellik stated the pair concisely as the two commands to run in order.Why the Other Options Are Wrong
The command git commit -m 'tag v3.0.5' (D) creates a commit whose message happens to contain the text tag v3.0.5, which is not a tag at all. The string lives in the commit log and has none of the ref semantics a tag requires, so it neither creates v3.0.5 nor publishes anything. The command git add 'tag v3.0.5' (E) stages a file whose name is tag v3.0.5, which stages a file path rather than a ref, so it accomplishes nothing toward creating a tag unless such a file exists, in which case it merely stages it. Using git push -force (A) forces the remote ref to be overwritten, which is a destructive operation intended for rewriting history. A newly created tag conflicts with nothing, so forcing is unnecessary and introduces a risk of discarding remote state.Community Comment Notes
The community was unanimous at 100 for B and C, and the single substance comment from UrbanRellik gave the answer as the two commands in execution order, which is exactly the right level of detail for a two-command question. The absence of further debate reflects that the question has no genuine ambiguity: creating a tag locally and then pushing it are separable operations and both are required, so the two selections are complementary halves of one solution rather than competing answers.Related Analysis
Practice All AZ-400 Questions
Access 100 questions with complete answers and detailed explanations.
View Full AZ-400 Practice Test →