我希望使用git在本地跟踪Github上的pull request随着请求的更新(例如添加更多提交)。 Github有一种方式,您可以通过检出只读refs / pull /来处理发送到您的repo的拉取请求。
换句话说,如果有人向我的存储库提交拉取请求,我可以在本地检索该请求:
git fetch upstream pull/123/head:123
git checkout 123
当有人更新了那个拉取请求时,问题就来了。我不知道该如何更新本地分支,因为git pull无法更新我的本地副本:
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=<remote>/<branch> 123
我已经尝试过:
git branch --set-upstream-to=upstream/refs/pull/123/head 123
git branch --set-upstream-to=upstream/refs/pull/123 123
git merge --ff-only refs/pull/123/head
merge: refs/pull/123/head - not something we can merge
git branch --set-upstream-to=origin/pull/123
这样的。在从远程获取之后,您可以使用git branch -a
检查所有分支引用。 - morxagit branch -a -vv
命令来检查你的本地 123 分支是否正在追踪远程分支。 - gzh