merge last 5 commits to single commit code example Example: git squash last 2 commits git rebase -i HEAD~2