Try git rebase -i
, and use 'squash' for all the commits you want to squash.
Edit:
git rebase -i
will show you an interactive editor with the list of commits you are rebasing. The default command before each commit is "pick", so you just need to s/pick/squash/ for all the commits you want to squash, and then all of them will be squash into their last previous commit.
Make sure you are rebasing on a correct branch.