!#/bin/sh -e git --version mkdir repo cd repo git init touch a touch 0 git add 0 git commit -m 'zeroth commit' git add a git commit -m 'first commit' git checkout -b branch touch b git add b git commit -m 'second commit (branch)' git checkout master touch c git add c git commit -m 'third commit' git merge branch touch d git add d git commit -m 'fifth commit' git rebase -i -p HEAD~4