useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed