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.

  • setup pre-commit hook jshint
  • Using Git add --all after moving files between repo subdirectories
  • How to work with meteor, git and different dev platforms?
  • git permission denied (publickey) when verify connection
  • What strategy to push only a subset of the files in git?
  • BitBucket API 2.0 - GET diff of specific file in a pull request
  • * 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.

  • Show untracked files in JetBrains intellij for git
  • Remove file from github and history
  • Porting a Github repo to another language
  • Git has no idea files are the repository. I cannot remove them
  • More than one value for the key user.name Git
  • Is there a way to differentiate between tags of the same name fetched from different remotes?
  • One Solution collect form web for “Complex interactive rebase in one step?”

    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).

    Git Baby is a git and github fan, let's start git clone.