From This other answer on the same thread
Based on Chris Johnsen's answer:
I added this line to the [alias] section of my git config file (~/.gitconfig):
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"