git squash last commit into one before last code example Example: git squash last 2 commits git rebase -i HEAD~2