How to squash multiple commits into one

Sometimes a pull request contains multiple commits. It can happen for a variety of reasons.

Ideally, a pull request should have only one commit so that all the changes are in one place.

Here is a video of how to squash multiple commits into a single commit.