I was just wondering what does the -u
flag mean in this command?
git push -u origin master
The -u option does the following: For every branch that is up to date or successfully pushed, add an upstream (tracking) reference, used by argument-less, git-pull and other commands.
So, after pushing your local branch with the -u option, this local branch will be automatically linked with the remote branch, and you can use git pull without any arguments.
It's the same as --set-upstream
It's used to set origin as the upstream remote in your git config.
It may help if you don't want to manually specify the remote every time you run git push.
Also ...
As you're new to stackOverflow, take your time to read What types of questions should I avoid asking? section of the Help because sometimes you can find the answers by simply browsing the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With