如何用git将两个pull请求从一个分支合并到另一个分支



我有两个分支,比如master和feature。

这是master分支的实际git日志,我需要将其2个pull请求(#174和#173(合并到我的特性分支中。

commit e6a35ad0b2363932ac190ec602a7fd0c8bf9f04f (HEAD -> master, origin/master, origin/HEAD)
Merge: a922cb0 f45db00
Author: xyz
Date:   Wed Sep 2 17:55:32 2020 -0700
Merge pull request #174 from xyz/v4upgrade

readjust null values for string data type from v4
commit f45db00e1e4b1cce05eb1035b6bd3d3eab97f3bc
Author: xyz
Date:   Wed Sep 2 17:32:07 2020 -0700
readjust null values for string data type from v4
commit a922cb0a5eb4bf2b7734af8041fb9cffcd2cee5f
Merge: 5f00c71 c9ab5c3
Author: xyz
Date:   Tue Sep 1 23:42:48 2020 -0700
Merge pull request #173 from xyz/v4upgrade

Implementation for UI fields for user info API

我想将pull request #173pull request #174合并到feature分支。

我尝试了挑选提交,但出现了以下错误:

git checkout feature
git cherry-pick e6a35ad0b2363932ac190ec602a7fd0c8bf9f04f
error: commit e6a35ad0b2363932ac190ec602a7fd0c8bf9f04f is a merge but no -m option was given.
fatal: cherry-pick failed
git cherry-pick a922cb0a5eb4bf2b7734af8041fb9cffcd2cee5f
error: commit a922cb0a5eb4bf2b7734af8041fb9cffcd2cee5f is a merge but no -m option was given.
fatal: cherry-pick failed

如果您想将来自2个PR的更改合并到另一个分支中,那么从master到development(独立地(选择与PR相关的修订。

说。。。。像这样的东西:

git checkout -b temp dev # will work on temp to cherry-pick revisions
# cherry-pick changes related to commit_id_3
git cherry-pick $( git merge-base commit_id_3~ commit_id_3^2 )..commit_id_3^2
git checkout dev
git merge --no-ff -m "Merging changes from commit 3" temp # then we merge into dev

commit_1也可以做同样的事情。也就是说,假设这些PR是,并且在它们的历史中没有合并。

澄清:合并库允许知道commit_id_3(或其他(中合并的PR是从哪个版本开始的,因此cherry pick只能携带用于开发任何PR的修订。

相关内容

  • 没有找到相关文章

最新更新