When you are using Github, it's quite common to branch your work while working on a feature. Many times your branch contains a lot of small commits that when you merge it into your main branch you want a single commit message describing the full work in that branch.

Git offers a handy command called git merge --squash [your-branch]. This is then a followed by a regular git commit and git push.