How can I squash my last X commits together into one commit using Git?
If you want to squish every commit into a single commit (e.g. when releasing a project publicly for the first time), try:
git checkout --orphan git commit