Thanks to [this handy blog post](https://ariejan.net/2011/07/05/git-squash-your-latests-commits-into-one/) I found that you can use this command to squash the last 3 commits:

    git rebase -i HEAD~3

This is handy as it works even when you are on a local branch with no tracking information/remote repo.

The command will open the interactive rebase editor which then allows you to reorder, squash, reword, etc as per normal.


---
**Using the interactive rebase editor:**

The interactive rebase editor shows the last three commits.  This constraint was determined by `HEAD~3` when running the command `git rebase -i HEAD~3`.

The most recent commit, `HEAD`, is displayed first on line 1.  The lines starting with a `#` are comments/documentation.

The documentation displayed is pretty clear.  On any given line you can change the command from `pick` to a command of your choice.

I prefer to use the command `fixup` as this "squashes" the commit's changes into the commit on the line above and discards the commit's message.  

As the commit on line 1 is `HEAD`, in most cases you would leave this as `pick`. 
 You cannot use `squash` or `fixup` as there is no other commit to squash the commit into.

[![interactive rebase editor][1]][1]


  [1]: https://i.sstatic.net/JYUt2.png