How to merge a pull request 🔥🔥🔥

iamandrewluca profile image Andrew Luca Updated on ・1 min read

There are some rules that are best to follow when merging a pull request.

When merging a pull request, GitHub offers 3 options:

  • Create a merge commit
  • Squash and merge
  • Rebase and merge

We should use each of them depending of the situation:

  • If PR has only one commit and commit explains well what was done use Rebase and merge
  • If PR has only one commit but commit does not explain exactly what was done use Squash and merge and add commit name that will explain more exactly what was done
  • If PR has more commits but they are intermediary (ex: fix style, add object, remove test ) also use Squash and merge and add a commit name that will group all commits in one
  • If PR has more commits but every commit has an explicit title what has been done, each commit is a single unit, then use Create a merge commit so each commit will be visible in default branch

If you want to read more about how to write correct commit messages, follow the link https://conventionalcommits.org

Posted on by:

iamandrewluca profile

Andrew Luca


All in Developer! ♣️♥️♠️♦️


markdown guide

Wow. This is a really good strategy. Very nice tip, thanks! Squashing bad commits and commit messages sounds great as sometimes the source history for a branch is not useful anyway.

Usually my team aims for good commits like in your last point, but it doesn't always happen.


Thanks very much. That's already what I use ;). Highly recommended for everyone.