Answer the question
In order to leave comments, you need to log in
What is the difference between git push -u origin master and git push origin master? Why the -u switch for the git push command?
The question is essentially to the -u switch for the git push command:
-u, --set-upstream
For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch.<name>.merge in git-config(1).
Answer the question
In order to leave comments, you need to log in
In case the master branch (or branch_name) is not a tracked branch origin/master (or origin/branch_name) and you want to make it so.
By executing the git push -u origin master command , you establish a link between the branch you are on and the master branch on the remote server. The command needs to be executed once, so that later you can send / receive changes only by performing git push from the branch without specifying any aliases for the server and remote branches. This is for convenience.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question