views:

21

answers:

1

I use git checkout -b somebranch origin/somebranch to make sure my local branches track remotes already. I would like a way to pull from the tracked branch no matter which branch I am using. In other words, I want to say git pull or some other command, without specifying the branch, and have it mean git pull origin somebranch if I'm on the local branch somebranch

Is there a way to do this without putting an entry in the config file for each branch? It would be difficult to maintain if we have to remember to manually enter some config stuff for each branch.

A: 

I am not sure this is possible unless you have first tracked oll the branches from origin repo (see the SO question "Track all remote git branches as local branches")

The other solution would be (not tested) to make a alias for:

$ git pull refs/heads/*:refs/remotes/origin/*

From git pull man page:

The above specifies that all remote branches are tracked using tracking branches in refs/remotes/origin/ hierarchy under the same name.

VonC
All branches are tracked... They're just not set up to pull.
Sean Clark Hess
Ah, nevermind! My mistake. I had one branch that was set up using git checkout -b somebranch origin/somebranch. The rest were created locally and pushed up. Thanks
Sean Clark Hess