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.

Sean Clark Hess
  • 15,859
  • 12
  • 52
  • 100

1 Answers1

0

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250