let's suppose there are 4 commits on top of the latest master that we want to squash
commit 1
commit 2
commit 3
commit 4
origin/master, origin/HEAD, master
- rebase on master with SHA
git rebase -i [SHA]
- ^^ command will open up a text editor with every commit starting with the keyword pick apart from the top most commit, change every commit's pick to squash
close the editor
-
^^ this will open an text editor with commit messages from every commit. Either you can leave the file as is or remove every commit and type a single commit
-
close the editor and you have successfully squashed all 4 commits