This can be done easily without
git rebase or
git merge --squash. In this example, let's squash the last 2 commits.
If you want to squash and write a new commit message, use the command below
git reset --soft HEAD~2
2 above points at the last 2 commit counting from the HEAD which is the top most commit in history