Fun with git rebase interactive - Anjum219/Git-basics GitHub Wiki
To access a lot of features in git interactive mode-
git rebase -i HEAD~<no_of_commits>
Or checkout in your branch and
git rebase -i master
Now, in place of pick, type the suggested keywords to apply required changes. For example, to squash the 5th commit with the 4th, erase the pick before 5th commit and type s. Then press Ctrl+S. Then Ctrl+X to exit. After, a message is shown. Then again, Ctrl+X.
For vi editor, you have to press escape and then write wq after a : to write the changes and quit. If you want to quit the editor without saving your changes, hit escape and type q! after the :.
You can drop a commit too with d.