How to Squash git commits

To “squash” commits is to take a series of commits and turn them into a single commit representing all of the changes made.

Squashing commits might be requested before allowing a PR to be merged.

To squash commits on a local branch, feature-1:

  1. Make sure you’re up to date with the master branch with git pull origin master:master
  2. On your feature branch, run interactive rebase with git rebase -i master
  3. Change picks to squashs.
  4. Save and close
  5. Change the commit message to be descriptive of your new commit.
  6. Save and close again.
  7. Do a force push as safely as you can with git push --force-with-lease