Git 如何将本地分支设置为从特定远程分支拉入/合并?

Git 如何将本地分支设置为从特定远程分支拉入/合并?,git,Git,我在当地有一家分支机构foo,最初是作为master的分支机构。然后我把它推到了我的遥控器上,它现在和它的兄弟姐妹们在遥远的地方过着幸福的生活 我想要pull自动从remotes/origin/foo进行pull,我想要status-sb显示我在remotes/origin/foo之前做了多少更改 我认为这样做的方法是 git config branch.foo.merge 'refs/heads/foo' 然而,在这样做之后,我得到了以下信息: ➔ git status -sb ## foo

我在当地有一家分支机构foo,最初是作为master的分支机构。然后我把它推到了我的遥控器上,它现在和它的兄弟姐妹们在遥远的地方过着幸福的生活

我想要pull自动从remotes/origin/foo进行pull,我想要status-sb显示我在remotes/origin/foo之前做了多少更改

我认为这样做的方法是

git config branch.foo.merge 'refs/heads/foo'
然而,在这样做之后,我得到了以下信息:

➔ git status -sb
## foo
➔ git pull
Your configuration specifies to merge with the ref 'foo'
from the remote, but no such ref was fetched.

我做错了什么?

您需要确保
branch.foo.remote
branch.foo.merge
都设置正确,然后无参数的
git pull
才能正常工作


请注意,您也可以使用
-u
-set upper
git push
在推送操作中设置此信息。

是否正确设置了
branch.foo.remote
不正确。这就解决了!