The u means upstream and it refers to the main remote repository to which you will do pull
and push
, this option is used only once.
When you have more than one remote repository you can use this option to configure one of them as the main one ... assuming you have a repo in BitBucket (bitbucket), another in GitHub (origin) and another in GitLab (gitlab) and you would like to use GitHub (origin) as the main one, you would have to do git push -u origin <branch>
and the following times when doing only git push
will do it to GitHub without having to specify the repository but for the other two if you would have to do it, eg. git push bitbucket <branch>
or git push gitlab <branch>
. Even if you have only one repository and you want to avoid writing git push origin <branch>
you can use this option and only do git push
the following times.
This option is also known as "argument-less git-pull / push (git-pull / push without arguments)"