I spent twenty minutes writing a commit message today. Twenty minutes for three lines of text.
The change was simple: fix a bug where user avatars weren’t loading on mobile. The fix was even simpler: add a missing CSS property. But the commit message… that required thought.
“Fix avatar bug” tells you nothing. “Add missing CSS property” is slightly better but still vague. “Fix user avatar display issue on mobile devices by adding object-fit property to avatar images” is verbose but informative.
I settled on: “Fix mobile avatar display by adding object-fit: cover to .avatar class”
It’s specific enough that future me (or any poor soul debugging this six months from now) will understand what was changed and why. But not so verbose that it becomes noise in the git log.
Good commit messages are love letters to your future self. They’re breadcrumbs through the forest of code changes. They’re the difference between understanding a codebase and drowning in it.
Some developers treat commit messages as afterthoughts. Quick, throwaway lines like “fix stuff” or “updates” or the dreaded “WIP”. These are acts of violence against future developers.
A good commit message answers three questions:
- What changed?
- Why did it change?
- What impact does this change have?
Twenty minutes well spent, I think.