Automatically Squash Commits on GitHub when Merging Pull Requests

Joe Previte
InstructorJoe Previte
Share this video with your friends

Social Share Links

Send Tweet

Learn how to automatically squash commits on GitHub when merging pull requests. You can make this automatic in your repo's settings on GitHub or by clicking it in the dropdown menu when you go to merge a PR.

If you prefer to learn by reading, you can read the accompanying blog post.

Joe Previte: [00:00] From the repository page on GitHub, head over to Settings. From here, scroll down to the bottom until you see Merge button. Select Allow squash merging and we'll remove the others so that's the default option.

[00:13] Now, when you look at a PR, you'll notice that the Squash and merge button is there by default. If we had kept the other options, it would have showed them here as well. When we click Squash and merge, it will squash the commits into a single commit, and that's it. You can now automatically squash commits while merging pull request on GitHub.