更新时间:2023-01-19 12:26:01
最简单的方法是将 Repo 2 添加为樱桃选择提交 E
并在 C
顶部的 F
.
The easiest thing to do would be to add Repo 2 as a remote in Repo 1 using its physical path on disk and then simply cherry pick commits E
and F
on top of C
.
因此,在回购1 中,您将执行以下操作:
So, in Repo 1 you would do:
git remote add repo2 C:\Path\To\Repo2
git fetch repo2
然后,假设 E
和 F
是 Repo 2 中 master
分支中的最新两次提交,并且 C
是 Repo 1 中 master
中的最新提交,如下所示:
then, assuming E
and F
are the latest two commits in the master
branch in Repo 2 and C
is the latest commit in master
in Repo 1, like this:
master
/
A-B-C
repo2/master
/
D-E-F
您会这样做:
git checkout master
git cherry-pick repo2/master~2..repo2/master
将在 C
之上应用来自提交 E
和 F
的补丁:
which will apply the patches from commits E
and F
on top of C
:
master
/
A-B-C-E'-F'
repo2/master
/
D-E-F
请注意,这里我选择的是提交范围,从Git 1.7开始受支持.2 .
Note that here I'm cherry-picking a range of commits, which is supported since Git 1.7.2.