I want to rebase some commits from master branch to another orphaned branch. The history of the repo is quite messy and the master branch has commits with 1 or 2 parents.
If I try to do rebase: git rebase --onto orphan commit1 commit2
- the git attempts to rebase some misty commits that are not on the range from commit1
to commit2
, and as a result a lot of conflicts.
If I try to do cherry-pick: git cherry-pick commit1..commit2
- then I get error:
Commit xxx is a merge but no -m option was given.
Or otherwise: git cherry-pick -m1 commit1..commit2
- I get:
Mainline was specified but commit yyy is not a merge.
Is there a simple way to achieve my goal?