Integrated interactive permutation in one step?

I have two branches in git with this form.

* 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 reinstall and reorder commits, as if I were with rebase -interactive. However, I want to alternate several commits and complete the form 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 reboot in one step? I tried to do this in two steps, restarting commit b over commit e, and then doing a second interactive rebase to sort everything commits. The problem is that I get merge conflicts (between commit b and commit e, for example), which I will not see otherwise (by placing commit b after commit a) and it’s not worth resolving the conflicts.

+6
git git-rebase rebase
source share
1 answer

Start from any branch (BranchWithF or BranchWithE) and issue an interactive rebase, for example

  git checkout BranchWithF
 git rebase -i HEAD ~ 3

When the editor and the list of commits appear, add (read: enter on the keyboard ...) and alternate

  pick aaaaaaa
 pick ccccccc
 pick eeeeeee

to the list that suits you.

Subsequently, BranchWithF will have all 6 commits, and you can discard BranchWithE (which still has 3 commits).

+8
source share

All Articles