Replay the last N git commits on a different branch

Rebase should do it.

git rebase -p --onto master testing~10 testing

This will copy the last ten commits on testing to master and make that the new testing (the old testing will be an orphan). Then you can merge master to testing as a fast-forward.

git checkout master
git merge testing

Leave a Comment