Linus Torvalds' Advice On Git Merges: "If you cannot explain a merge, then JUST DON'T DO IT"
The Linux 6.3 merge window has been off to a good start with Linus Torvalds receiving plenty of pull requests in advance, the other early pulls all coming in quite orderly, and no colorful commentary on any of the material set for Linux 6.3 even with the likes of Microsoft Pluton (TPM2 CRB). But today Torvalds' did feel the need to share some wisdom around Git merge log message advice.
Linus Torvalds practical advice on Git merges comes down to: "if you cannot explain a merge, then JUST DON'T DO IT. It's really that simple. There is absolutely *NEVER* an excuse for merges without explaining why those merges exist."
The lack of a message explaining this merge fired up Linus Torvalds.
Below is the Git and Linux kernel creator's commentary posted a short time ago to the LKML in response to the hardening pull request.
So I've pulled this, but while looking at it, I see commit 5c0f220e1b2d ("Merge branch 'for-linus/hardening' into for-next/hardening").
And that one-liner shortlog part is literally the whole commit message.
I've said this before, and apparently I need to say this again: if you cannot be bothered to explain *WHY* a merge exists, then that merge is buggy garbage by definition.
This really should be a rule that every single developer should take to heart. I'm not just putting random words together in a random order.
I repeat: if you cannot explain a merge, then JUST DON'T DO IT.
It's really that simple. There is absolutely *NEVER* an excuse for merges without explaining why those merges exist.
In this case, I really think that merge should not have existed at all, and the lack of explanation is because there *IS* no explanation for it.
But if there was a reason for it, then just state it, dammit, and make that merge commit look sensible.
Because right now it just looks entirely pointless. And I literally *detest* pointless merges. They only make the history look worse and harder to read.
It ended up being that the merge was of fixes for the prior Linux 6.2 cycle but the developer involved will work to express it more clearly in the future.