how to squash commits on a branch locally 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
git rebase -i HEAD~20
git reset --soft HEAD~3 &&
git commit