The method mentioned below only allows you to squash the last X consecutive commits into a single commit. Also, if you have merged master into your branch along the way, you will have to manually merge your new (squashed) commit into master and resolve the merge conflicts.
To squash the last 3 commits into one:
git reset --soft HEAD~3
git commit -m "New message for the combined commit"
To squash the last 3 commits into one:
git rebase -i HEAD~3
You can squash the commits manually from terminal.
If the commits have been pushed to the remote:
git push origin +name-of-branch
The plus sign forces the remote branch to accept your rewritten history, otherwise you will end up with divergent branches