0

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?

Charles
  • 48,924
  • 13
  • 96
  • 136
abyss.7
  • 12,136
  • 9
  • 44
  • 94
  • Did you try interactive rebase? – jonderry Jul 24 '14 at 08:42
  • @jonderry Never used it, but if you suggest that this thing will automatically resolve my problem, I will give it a try. But `interactive` makes me think that it's not automatic... – abyss.7 Jul 24 '14 at 08:49
  • You will see a list of commits that will be applied, and you can edit the list as you see fit. If you don't have a huge number of commits to apply, you might find it manageable. – jonderry Jul 24 '14 at 08:54
  • @jonderry There are hundreds and I want them all at once. – abyss.7 Jul 24 '14 at 08:55
  • Related: http://stackoverflow.com/questions/9229301/git-cherry-pick-says-38c74d-is-a-merge-but-no-m-option-was-given – jonderry Jul 24 '14 at 09:07
  • Try my answer to [a related question](http://stackoverflow.com/questions/26576291/how-to-squash-all-merges-in-a-branch/27514988#27514988) – Joseph K. Strauss Dec 22 '14 at 16:39

0 Answers0