I've got two branches (and master). Branch 2 is based on Branch 1 is based on master. I've submitted Branch 1 for review, it had some changes, I rebased some of those changes into history and merged the result into master.
Now I need to rebase Branch 2 on top of master to prepare it for review/merge.
The problem is that Branch 2 still contains the original commits of Branch 1, which don't exist anymore, so git gets confused. I tried rebase -i to drop the original commits of Branch 1, but the commits of Branch 2 don't base on top of master-before-branch-1.
What I need to do is take branch 2, drop some commits, and rebase just the remaining commits on top of master in a single operation. But I only know how to do these two operations in two distinct steps.
How can I rebase part of my branch onto another branch, dropping all commits that are not in common ancestry, except the ones I specify (e.g. from HEAD~2 up)?
Here's the current state:
master                     new branch 1
- - - - - - - - - - - | - - - - - - - - -
    \
     \   branch 1
      \ _ _ _ _ _ _ _
                     \
                      \     branch 2
                       \ _ _ _ _ _ _ _
What I want to end up with:
master            new branch 1    
- - - - - - - | - - - - - - - - - -
                                   \
                                    \
                                     \
                                      \    branch 2
                                       - - - - - - - - - 
 
     
     
     
     
    