How can I squash my last X commits together into one commit using Git?
Anomies answer is good, but I felt insecure about this so I decided to add a couple of screenshots.
See where you are with git log. Most important, find the commit hash of the first commit you don't want to squash. So only the :
Execute git rebase -i [your hash], in my case:
$ git rebase -i 2d23ea524936e612fae1ac63c95b705db44d937d
In my case, I want to squash everything on the commit that was first in time. The ordering is from first to last, so exactly the other way as in git log. In my case, I want:
If you have picked only one commit and squashed the rest, you can adjust one commit message:
That's it. Once you save this (:wq), you're done. Have a look at it with git log.