I've been using git push -u origin branch
for a while now.
but seeing my workmates manage to push a new branch using git push origin branch
without the switch u got me thinking, what are there main difference? are there any at all?
Asked
Active
Viewed 62 times
1

Viscocent
- 2,024
- 2
- 19
- 26
-
See also http://stackoverflow.com/a/17096880/6309 – VonC Jun 04 '14 at 04:54
1 Answers
4
git help push
will tell you
-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).
Meaning if you run git push -u some_repo some_branch
then after the push some_repo/some_branch
is set as the upstream for the subsequent pulls.
So the next time you have some_branch
checked out locally and you run git pull
it will automatically try to pull from some_repo/some_branch

Spundun
- 3,936
- 2
- 23
- 36