Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doing git-push without origin master

Tags:

git

git-push

Is there a way on GIT to just do a "git push" and it automatically send to "origin master" without specify that? Just curious...

like image 615
rizidoro Avatar asked May 20 '11 15:05

rizidoro


2 Answers

Your master branch should be automatically setup so this works. If you are on some other branch, then you can use the git branch command with the --set-upstream option

git branch --set-upstream someBranch origin/master

It might be also the case that you don't have a remote set, in the case when you have a bare and clean repository setup waiting for you to push to it for the first time, e.g. when you are setting up a repo on github. Assuming you have setup your remote you can push to the server with the -u option that will take care of the branch --set-upstream for you:

git push -u origin master

which is the same as:

git push origin master
git branch --set-upstream master origin/master
like image 180
ralphtheninja Avatar answered Oct 03 '22 04:10

ralphtheninja


The default behaviour is defined by the push.default configuration setting.

If you do a search for push.default on http://git-scm.com/docs/git-config you'll find an explanation for its various options.

like image 44
Paul Avatar answered Oct 03 '22 06:10

Paul