Based on [this article][1] I found this method easier for my usecase.

My 'dev' branch was ahead of 'origin/dev' by 96 commits (so these commits were not pushed to the remote yet).

I wanted to squash these commits into one before pushing the change. I prefere to reset the branch to the state of 'origin/dev' (this will leave all changes from the 96 commits unstaged) and then commit the changes at once:

<!-- language: shell -->
    git reset origin/dev
    git add --all
    git commit -m 'my commit message'

  [1]: http://makandracards.com/makandra/527-squash-several-git-commits-into-a-single-commit