How can I squash my last X commits together into one commit using Git?
Simple one-liner that always works, given that you are currently on the branch you want to squash, master is the branch it originated from, and the latest commit contains the commit message and author you wish to use:
git reset --soft $(git merge-base HEAD master) && git commit --reuse-message=HEAD@{1}