Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the -u flag mean in git push -u origin master?

Tags:

git

github

push

I was just wondering what does the -u flag mean in this command?

git push -u origin master
like image 519
user123456 Avatar asked Sep 18 '13 08:09

user123456


2 Answers

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.

like image 174
Shunya Avatar answered Oct 20 '22 04:10

Shunya


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.

like image 32
Ahmed Siouani Avatar answered Oct 20 '22 05:10

Ahmed Siouani