This site runs best with JavaScript enabled.

Automatically Squash Commits When Merging PRs

March 22, 2020

––– views

In the past, I didn't think much about my commit messages or my commit history. Over time, that has changed.

Now that I commit more often, I find it helpful to squash commits when I merge PRs. This keeps the commit history clean. I like it!

Here's how you can do it too:

  1. Go to your repo's homepage on GitHub
  2. Click on the "Settings" tab
  3. Scroll to the "Merge button" section
  4. Check the box for "Allow squash merging"

Now when you go to merge a pull request, you'll see an option called "Squash and merge".

Hooray! That's it :)

Discuss on TwitterEdit post on GitHub

Share article

Join the Newsletter

I send a couple emails per month related to programming and learning. I also share goodies and deals here.

Help others learn to code