git rebase -i HEAD~5
allows you to interactively select which of the 5 last commits to join into one; off the top of my head it opens the editor with something like this
pick xxxx commit1
pick xxxx commit2
pick xxxx commit3
pick xxxx commit4
pick xxxx commit5
you change this into
pick xxxx commit1
squash xxxx commit2
squash xxxx commit3
squash xxxx commit4
pick xxxx commit5
which results in two commits being left: first one that has combined commits 1 - 4, and commit 5 (the newest one) which is left alone