How can I set a local branch to pull / merge from a particular remote branch?
I have a local branch foo that started life 开发者_JS百科as a branch off of master. Then I pushed it to my remote, and it's now happily living life with its siblings in remotes/origin
I want pull to automatically pull from remotes/origin/foo, and I want status -sb to show me how many changes I am ahead of remotes/origin/foo.
I thought the way to do this was
git config branch.foo.merge 'refs/heads/foo'
However, after doing that, I get this message:
➔ git status -sb
## foo
➔ git pull
Your configuration specifies to merge with the ref 'foo'
from the remote, but no such ref was fetched.
What am I doing wrong?
You need to make sure that both branch.foo.remote
and branch.foo.merge
are set correctly before git pull
without parameters will work correctly.
Note that you can also use -u
or --set-upstream
with git push
to set this information on a push operation.
精彩评论