Better merge commit messages

I have used different code management systems depending on the company, from GitHub to Phabricator. But all companies have a very similar pattern:

Generally developers put a lot of effort adding the appropriate information in the PR template, this is ours. And although templates may vary a bit from company to company, they generally all have the following:

One of the issues that I have experienced lately working with GitHub is that the default merge commit message is awful. By default:

I use git blame a lot to get the context about the particular piece of code I am looking at. Our template gives all we need, because it has the internal task with all the details about why we did the PR plus a very comprehensive PR description and how it was tested. But, because GitHub does not use that as merge commit message, all that context is now hidden behind 3-4 clicks. What I would want is to have our PR description used as the merge commit message.

It has been tricky to find solutions for this as in my team not everybody uses the same development workflow. Some use the GitHub web UI to merge the PRs, while others 🙋‍♂️ use the GitHub CLI.

For the folks that use the web interface I found this plugin that seems to work very well.

For the rest I developed a simple solution based on GitHub CLI extensions. You can find it here.

How does it work?

If you have the GitHub CLI installed, installed the extension

$ gh extension install aitorvs/gh-merge-pr

and then run gh merge-pr [#].

The PR number is an optional parameter, if not provided it will try to merge the PR for the current branch, if it exists.

That is all. Enjoy your clean and useful commit history.