如何为同一分支中的每个提交单独提取拉取请求?

时间:2015-07-14 17:41:33

标签: git

我已将'a'提交到远程分支。我发送了一个特定提交的拉取请求。在合并提交之前,我推送了另一个提交。我想将这两个提交视为单独的pull请求,我不想为此创建一个新的分支。有办法吗?

2 个答案:

答案 0 :(得分:2)

由于每次提交都包含对其父项的引用,因此必须创建单独的分支,以便不包含该信息。

每个新分支上的

git cherry-pick可能是最简单的方法,尽管git rebase -i也可以。

你不需要害怕git的分支。与颠覆不同,git中的分支既便宜又简单,一旦合并PR就可以清理它们。

答案 1 :(得分:2)

通常您应该为每个拉取请求创建一个分支。但是你可以这样做:

git push <remote name> <commit hash>:<remote branch name>

//This will push all commits up to and including the specified commit.

//An example solution for your problem:
git push origin dc5ea3b083a6e6b08f0b3742f9fe55b3:myfirstremotebranchforpullrequest

git push origin 985ccb86d2a8b61e145a79206c599b76:mysecondremotebranchforpullrequest