Via https://stackoverflow.com/questions/25886147/git-rebase-skip-merge-commits
git init
touch C1
git add -A
git commit -am "C1"
touch C2
git add -A
git commit -am "C2"
touch C3
git add -A
git commit -am "C3"
git checkout f8e610d
git checkout -b feature
touch F1
git add -A
git commit -am "F1"
git merge master
touch F2
git add -A
git commit -am "F2"
git log --all --graph --decorate --oneline
* 19767e0 (HEAD -> feature) F2
* 11a9be2 Merge branch 'master' into feature
|\
| * 66860a0 (master) C3
| * 723a8d1 C2
* | f7ed465 F1
|/
* f8e610d C1
git rebase --onto master f8e610d feature
First, rewinding head to replay your work on top of it...
Applying: C2
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: C3
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: F1
Applying: F2
git log --all --graph --decorate --oneline
* d8b01d8 (HEAD -> feature) F2
* 4cee191 F1
* 66860a0 (master) C3
* 723a8d1 C2
* f8e610d C1