Complex interactive rebase in one step?
I have two branches in git with this shape.
* fffffff commit f * ddddddd commit d * bbbbbbb commit b | * eeeeeee commit e | * ccccccc commit c | * aaaaaaa commit a |/ * 2222222 base revision 2 * 1111111 base revision 1
I want to rebase and reorder the commits like I would with rebase --interactive. However I want to interleave several of the commits and wind up with a shape like this.
* ffffff2 commit f * eeeeee2 commit e * dddddd2 commit d * cccccc2 commit c * bbbbbb2 commit b * aaaaaaa commit a * 2222222 base revision 2 * 1111111 base revision 1
Is there a way to do this rebase in one step? I tried to do it in two steps by rebasing commit b on top of commit e and then doing a second interactive rebase to sort all the commits. The problem is that I get merge conflicts (between commit b and commit e for example) that I would not see otherwise (by placing commit b after commit a) and it's not worth resolving the conflicts.
Start with any one branch (either BranchWithF or BranchWithE) and issue the interactive rebase, for example
git checkout BranchWithF git rebase -i HEAD~3
When the editor and the commit list pops up, add (read: type on your keyboard...) and interleave
pick aaaaaaa pick ccccccc pick eeeeeee
to the list as you see fit.
Afterwards, BranchWithF will have all 6 commits, and you can throw away BranchWithE (which still has its 3 commits).