I created a tracking branch so whowasout.com tracked whowasout.com/master
$ git remote -v
origin [email protected]:venkatd/whowentout.git (fetch)
origin [email protected]:venkatd/whowentout.git (push)
whowasout.com [email protected]:whowasout.com (fetch)
whowasout.com [email protected]:whowasout.com (push)
$ git branch -vv
master c33b5dc [origin/master] Merge branch 'whowasout.com'
* whowasout.com 7b6b240 [whowasout.com/master: ahead 1] print statement in test.
php
When I commit some changes in the whowasout.com branch and execute "git push", master gets pushed to origin/master. Is this expected behavior? I was expecting whowasout.com to push to whowasout.com/master.
To push my changes, I currently type "git push whowasout.com whowasout.com:master" but I thought tracking would make this process quicker. Am I on the right track?
You will have to do:
This is because
whowasout.com
doesn't have a branchwhowasout.com
and you don't want one. What you really want is to push whowasout.com branch on local to master on whowasout.com remote, which has to be done like above.To get the behaviour that you want so that just
git push
pushes from whowasout.com branch on local to master on remote, you have to set thepush.default
config toupstream
( previously calledtracking
)Note that you have to do this because, by default, tracking branches are helpful in tracking the upstream branch when you are doing fetch / pull. When you change the
push.default
setting, it comes into play in push as well. Otherwise, push just pushes matching refs, i.e whowasout.com branch will be pushed to whowasout.com branch on remote whowasout.com.