squash in commits code example Example 1: squash commits on branch git rebase -i HEAD~20 Example 2: squash commits in git git reset --soft HEAD~3 && git commit