是否可以合并为拉取请求

时间:2016-04-15 14:09:39

标签: git github

我在拉取请求中有两个提交;一个是另一个的后代。例如;

(后代)

https://github.com/common-workflow-language/cwltool/commit/a42ef0604e1957c8c91fde26a2f939444df5009b

(父)

https://github.com/common-workflow-language/cwltool/pull/64/commits/e2231e1d1eabffa68bcfdc2e0fbe2419a7204b07

如何将后代合并到pull请求中?据推测,我必须做一些事情,比如将后代拉入父母,然后重新提交?我似乎无法让这个工作。我尝试了各种方法(即采摘樱桃),但似乎无法做到。感谢您的帮助和专业知识。

1 个答案:

答案 0 :(得分:2)

A pull request is just a request to merge one branch into another. You can update a pull request at any time by changing the commit the source branch for that PR is pointing to. So to merge the "descendant" pull request into its parent, just merge the source branch for the descendant pull request into the source branch for the parent PR.

E.g. if you have pr1, the source branch for the parent PR, and pr2, the branch for the descendant PR:

Commit graph with pr1 and pr2

Just checkout pr1, run git merge pr2, then push with git push origin pr1:

After merge and push

That should update the PR in GitHub. Try it out in Learn Git Branching!