How to enforce good commit messages without automated tools?
I recently came to think about how to enforce good commit messages without enforcing a commit message style such as conventional commits (read more about my passionate hate for conventional commits here).
Disclaimer: This article does not provide a solution, as I don't have one yet.
The Why
We all know know what a good commit message is.
You didn't believe this, did you?
It is more like some of the developers out there and how to write one, but most kiddies out there don't. And these commits from last night are only the ones containing swear-words. We all know projects where the developers just don't care about good commit messages and things like “implement #1241” is “considered” a “good enough” commit for a 1200 lines-of-code change that touches 15 files.
I do not really have to reiterate what others have already stated numerous times, do I?
The How
In my post about my hate for conventional commits I already wrote why I think automating these kind of things is bad idea. But to reiterate this shortly: Enforcing a certain “style” of commit messages, such as common prefixes, certain trailers and so on, makes people resort to only fullfill the automatically tested things.
So if you enforce that a commit message subject should start with one of fix
, change
or doc
, people will no longer write "Implement JSON backend"
as commit message, but "change: Implement JSON backend"
. What have you gained? Nothing.
Instead, I want people to write commit messages that tell me why a change was made. Something in the lines of
Implement JSON backend
This patch implements the JSON backend using the JSONFOO library. Note that content is currently not read in a zero-copy fashion with this patch, to keep the diff small.
Zero-copy JSON handling will be implemented in a seperate patch once we confirmed that JSON is working as expected
Signed-off-by: Ned Stark ned@nohead.email
Manual commit message review
In my opinion, commit message review should be part of every normal code review. What I think, though, is that interfaces such as githubs review interface do not particularly encourage this. Also, I feel like requesting commit messages changes is socially not as accepted as code change requests are. Asking a developer to change a function name is (at least from my perspective) seen as a normal request. Asking a developer to rewrite their commit messages is not.
I don't know why this is or how I got to this impression, but I feel this way and it concerns me. It really should be as socially acceptable as requesting a code change, because it is equally (or maybe even more) important as the code itself.