Automatically Squash Commits on GitHub when Merging Pull Requests

Joe Previte
InstructorJoe Previte
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 2 years ago

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.

egghead
egghead
~ 5 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today