300-835 · Question #33
Which Git command sends local changes from every branch to the remote repository?
The correct answer is D. git push -all. git push --all (option D) is correct because the --all flag instructs Git to push every local branch to the remote repository in a single command, rather than targeting one specific branch. Why the distractors are wrong: A. git add -all - git add stages files for a commit; it…
Question
Options
- Agit add -all
- Bgit commit -m "all"
- Cgit push origin master
- Dgit push -all
How the community answered
(22 responses)- B5% (1)
- C9% (2)
- D86% (19)
Explanation
git push --all (option D) is correct because the --all flag instructs Git to push every local branch to the remote repository in a single command, rather than targeting one specific branch.
Why the distractors are wrong:
- A.
git add -all-git addstages files for a commit; it has no concept of remote repositories, and-allis not valid syntax (the correct flag is--allor-A). - B.
git commit -m "all"-git commitsaves staged changes to local history only; the string"all"is just a commit message, not a special flag, and nothing is pushed remotely. - C.
git push origin master- this pushes only themasterbranch to the remote namedorigin, not every branch.
Memory tip: Think of --all as "push all branches at once." If you only name a branch (like origin master), you get just that one - drop the branch name and add --all to go wide.
Note for accuracy: In practice the correct syntax uses a double dash:
git push --all. Single-dash-allis technically incorrect in real Git, but exam questions sometimes abbreviate it - map it to--allin your head.
Topics
Community Discussion
No community discussion yet for this question.