我已经在本地签出了PR。现在PR已更新,如何使用最新的提交更新本地分支。当我尝试去做git fetch upstream
git pull origin
他们所有人都说该分支不存在。那是因为它是PR,而不是分支机构。如何更新我的本地存储库?
[当您check out a PR locally时,您正在获取特定名称空间中的分支:
git fetch origin pull/ID/head:BRANCHNAME
# or
git fetch upstream pull/ID/head:BRANCHNAME
但是如果您执行git config -l,您可能会看到类似这样的设置:
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
与您的远程获取分支相关联的[refspec,而不是与pull/branches
相关联。
您需要添加:
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
为了能够获取任何pr分支。