tags:

views:

35

answers:

1

Suppose I have a tracking branch named 'abc' which tracks origin/master.

When I'm on 'abc' and do a git push, it pushes 'abc' to 'abc'.
How do I specify the remote push branch for it with just a 'git push'?

+2  A: 
git branch --set-upstream abc origin/master

should be able to specify the remote branch.

Since Git1.7.0:

"git branch --set-upstream" can be used to update the (surprise!) upstream, i.e. where the branch is supposed to pull and merge from (or rebase onto).

VonC
And if your git's older, it's pretty easy to just edit `.git/config` and put in the branch and remote you want (you should have your master branch as an example to copy from, if needed, since it's set up automatically when you clone).
Jefromi
@VonC: I tried as you said. But when I do "git push", Git still doesn't understand that it's the current branch that I want to push up to the remote. It still pushs every tracking branch for me.
Shawn
@Shawn: that is normal: http://www.kernel.org/pub/software/scm/git/docs/git-push.html#OPTIONS. You need to do do `git push origin abc` otherwise you are using ':' which a special refspec used only for *matching* branch names.
VonC