问题 如何从我的fork向另一个fork发送pull请求?


我分叉了一个存储库 R 如 R1。然后我做了一些改动 R1

B分叉了存储库 R 如 R2,和 R2 成为主要维护的存储库。

现在我想发送拉请求 R2, 怎么做?

如果我想保留我的话怎么办? R1 更新了 R2


1293
2017-12-23 08:34


起源



答案:


发送拉取请求 R2 你可以点击 Pull Request 上 R1 (你自己的叉子)页面,然后 Edit 并选择 R2 存储库 base fork 部分。

从中提取更新 R2 把它们推到你的身边 R1 存储库,您可以添加新的远程 R2 像那样:

git remote add r2 git://github.com/<path-to-r2-on-github>.git

然后你可以从中获取变化 r2/master 到你当地 master 像那样:

git checkout master # checkout your local master
git pull r2 master  # pull changes from master branch of r2 remote repository

然后将它们推送给你 R1 (我猜你有 R1 配置为 origin 远程):

git push origin master # push changes (that you previously pulled from r2) 
                       # from local master to master in R1 repository

12
2017-12-23 08:45



在R2的页面中,我只能看到 Pull Requests 列出拉取请求,但不发送拉取请求。有 pull request 在 R1的页面,发送拉请求 R。 - wenlong
哦对不起。首先,你必须创建自己的分叉 R2。将它作为新的远程添加到本地存储库,并将请求分支拉入此r2分支。然后你就可以从你的新r2 fork发送pull请求到原来的r2 repo。我更新了答案。 - KL-7
只要 Your Fork 在R2的页面中,我发现我可以选择 R2 fork提交到。 :-) - wenlong
嗯,这应该是由 R1 和 R2 从同一个分叉 R 库。 - KL-7


答案:


发送拉取请求 R2 你可以点击 Pull Request 上 R1 (你自己的叉子)页面,然后 Edit 并选择 R2 存储库 base fork 部分。

从中提取更新 R2 把它们推到你的身边 R1 存储库,您可以添加新的远程 R2 像那样:

git remote add r2 git://github.com/<path-to-r2-on-github>.git

然后你可以从中获取变化 r2/master 到你当地 master 像那样:

git checkout master # checkout your local master
git pull r2 master  # pull changes from master branch of r2 remote repository

然后将它们推送给你 R1 (我猜你有 R1 配置为 origin 远程):

git push origin master # push changes (that you previously pulled from r2) 
                       # from local master to master in R1 repository

12
2017-12-23 08:45



在R2的页面中,我只能看到 Pull Requests 列出拉取请求,但不发送拉取请求。有 pull request 在 R1的页面,发送拉请求 R。 - wenlong
哦对不起。首先,你必须创建自己的分叉 R2。将它作为新的远程添加到本地存储库,并将请求分支拉入此r2分支。然后你就可以从你的新r2 fork发送pull请求到原来的r2 repo。我更新了答案。 - KL-7
只要 Your Fork 在R2的页面中,我发现我可以选择 R2 fork提交到。 :-) - wenlong
嗯,这应该是由 R1 和 R2 从同一个分叉 R 库。 - KL-7