The art of the commit message

Commit messages are really helpful, but not always top of mind while you’re actually working on something. I’m pretty sure I’ve got a fair number of commit messages titled along the lines of, “ashdfkafwaieu argh just work already!”

WordPress commits have — at least in recent history — been helpful, even if one late night before a major releases the neditor escaped, or lyrics to a Slick Rick beat got slipped in.

Helen Housandí has updated the WordPress Core Handbook (which is a great resource all around!) to showcase how to write good commit messages. Granted, only a small number of people have commit privileges for WordPress itself, but this is useful to anyone writing code.

The whole doc is valuable, but at a bare minimum check out the differences between three messages from bad to good:

Bad:

Don’t use strict comparisons for term IDs. props booneiscool. fixes #3398.

Meh:

Fixing `wp_dropdown_categories()` and other places that use term IDs.

props boonerocks. fixes #20000.

Good:

Taxonomy: Relax term ID comparisons.

Term IDs are sometimes provided as strings. This is particularly evident in `wp_dropdown_categories()`, where the `selected` argument was not being respected. Plugin authors should also be wary of using strict comparisons for term IDs.

Props booneistheman.
Fixes #13237

Most commit messages follow a similar pattern. And I know this encourages me to make better commit messages. Check out the whole guide, and while you’re at it peruse the Core Handbook in general, you might learn a few things!

Similar Posts