0

我想将一些从主分支的提交重新定位到另一个孤立的分支。回购的历史相当混乱,主分支有 1 或 2 个父母提交。

如果我尝试做 rebase: git rebase --onto orphan commit1 commit2- git 会尝试 rebase 一些不在 from commit1to范围内的模糊提交,因此会commit2产生很多冲突。

如果我尝试做cherry-pick: git cherry-pick commit1..commit2- 那么我会得到错误:

Commit xxx is a merge but no -m option was given.

否则:git cherry-pick -m1 commit1..commit2- 我得到:

Mainline was specified but commit yyy is not a merge.

有没有一种简单的方法可以实现我的目标?

4

0 回答 0