如何使用对PR的最新提交来更新本地已签出的PR代码?

问题描述 投票:1回答:1

我已经在本地签出了PR。现在PR已更新,如何使用最新的提交更新本地分支。当我尝试去做git fetch upstreamgit pull origin他们所有人都说该分支不存在。那是因为它是PR,而不是分支机构。如何更新我的本地存储库?

git bitbucket git-pull git-fetch
1个回答
0
投票

[当您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分支。

© www.soinside.com 2019 - 2024. All rights reserved.