Lets say we have 2 commit we want to merge
f68ffb5 commit 6
...
d294fac commit 1
This is important: you have to give reference to a commit before the first one involved (in this case, the one that you want to squash to). Here we make the "before" reference with ^.
# rebase to the commit **before** commit 1
git rebase -i d294fac^
You invoked an interactive rebase. An editor window opens. Rearrange commits as desired (read the notes in the editor that opens)
In this list the commits go in reverse order (not as in git log): from the earliest to the latest.
Rearrange lines in the following way:
pick d294fac //--- commit 1
squash f68ffb5 //--- commit 6
pick
pick
pick
pick
or (leave the squashed commits in last place)
pick d294fac //--- commit 1
squash f68ffb5 //--- commit 6
pick
pick
pick
pick