nerdexam
Cisco

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…

Network Programmability Foundation

Question

Which Git command sends local changes from every branch to the remote repository?

Options

  • Agit add -all
  • Bgit commit -m "all"
  • Cgit push origin master
  • Dgit push -all

How the community answered

(22 responses)
  • B
    5% (1)
  • C
    9% (2)
  • D
    86% (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 add stages files for a commit; it has no concept of remote repositories, and -all is not valid syntax (the correct flag is --all or -A).
  • B. git commit -m "all" - git commit saves 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 the master branch to the remote named origin, 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 -all is technically incorrect in real Git, but exam questions sometimes abbreviate it - map it to --all in your head.

Topics

#git push#Remote repository#Git branches#Version control

Community Discussion

No community discussion yet for this question.

Full 300-835 Practice