GitHub上的一个项目,我有一个fork,它有一个新的pull请求,我想把它拉到我的fork中,但作者还没有拉进去。
有一个简单的方法来应用从其他叉子的拉请求到我的叉子?这里还有什么我没注意到的吗?
GitHub上的一个项目,我有一个fork,它有一个新的pull请求,我想把它拉到我的fork中,但作者还没有拉进去。
有一个简单的方法来应用从其他叉子的拉请求到我的叉子?这里还有什么我没注意到的吗?
当前回答
你可以很容易地手动完成:
add the other fork as a remote of your repo: git remote add otherfork git://github.com/request-author/project.git fetch his repo's commits git fetch otherfork You have then two options to apply the pull request (if you don't want to choose pick 1.) If you don't care about applying also the eventual commits that have been added between the origin and the pull request, you can just rebase the branch on which the pull request was formed git rebase master otherfork/pullrequest-branch If you only want the commits in the pull request, identify their SHA1 and do git cherry-pick <first-SHA1> <second-SHA1> <etc.>
其他回答
一些对我有用的更详细的信息。
我的.git/配置文件分叉回购看起来像这样:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
url = git@github.com:litzinger/angular-carousel.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
rebase = true
[remote "source"]
url = git://github.com/revolunet/angular-carousel.git
fetch = +refs/heads/*:refs/remotes/source/*
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
然后运行“git fetch source”,然后列出来自fork repo的所有拉请求。
* [new ref] refs/pull/54/head -> origin/pr/54
* [new ref] refs/pull/67/head -> origin/pr/67
* [new ref] refs/pull/69/head -> origin/pr/69
* [new ref] refs/pull/71/head -> origin/pr/71
然后在一个特定的pull请求中合并运行"git merge master origin/pr/67"
就像Tekkub之前说的,你可以直接把分支拉进去。在GitHub的大多数情况下,分支只是请求用户的项目分支的“主”。
示例:git拉https://github.com/USER/PROJECT/ BRANCH
举个实际的例子:
假设你fork了一个名为safaribooks的github项目,在初始项目中有以下拉请求,你想把它放在你的fork中:
然后,在fork的克隆项目文件夹中,运行:
git pull https://github.com/fermionic/safaribooks.git fix-str-decode
更新:网页
你也可以通过github网页做到这一点。
我假设,您应该已经有一个通用回购(BaseRepo)的fork (MyFork),它有来自您感兴趣的fork (OtherFork)的未决拉请求。
导航到fork (OtherFork),它已经启动了你想要进入你的fork (MyFork)的拉请求 进入OtherFork的pull requests页面 点击新的拉请求 应该提供挂起的拉请求。记住要选择合适的OtherFork分支。选择左边作为基础叉你的叉(MyFork)(重要)。 现在查看拉请求的选项应该更改为创建拉请求。点击这个。
现在你的fork (MyFork)中应该有一个未决的拉请求,你可以简单地接受它。
我会这样做;
git checkout master
git remote add #NAME# #ADDRESS TO REPO#
git fetch #USERNAME#
git checkout -b test_fork
git rebase #NAME#/#BRANCH#
现在,我已经将更改合并到一个名为test_fork的测试分支中。这样任何改变都不会弄脏树。
如果更可取的话,还可以像上面描述的那样使用cherry-pick来选择特定的提交。
快乐旅行:)
你可以很容易地手动完成:
add the other fork as a remote of your repo: git remote add otherfork git://github.com/request-author/project.git fetch his repo's commits git fetch otherfork You have then two options to apply the pull request (if you don't want to choose pick 1.) If you don't care about applying also the eventual commits that have been added between the origin and the pull request, you can just rebase the branch on which the pull request was formed git rebase master otherfork/pullrequest-branch If you only want the commits in the pull request, identify their SHA1 and do git cherry-pick <first-SHA1> <second-SHA1> <etc.>