I’ve been pair programming with a lot of different people, with a variety of skill levels, on Growstuff over the last year. One thing I’ve noticed is that some people freeze up when it comes to writing a commit message. They type “git commit” and then sit there for a minute going “uhhhh”.
I understand this. It’s hard to convert maybe an hour’s hard work in code into a short sentence of English. How do you compress such complex ideas? How do you even make words, when your brain has been deep in code?
So here’s the tip I give to my pairing buddies who freeze up when it comes time to commit, and I offer it here for free: Start your commit message with a verb.
“Added…” “Fixed…” “Removed…”
“Refactored…”
The rest usually comes easily. What did you add? What did you fix? What did you refactor? Grammatically, this is the direct object, and starting with a verb works as an effective prompt to figure out what it might be.
Sometimes you need an indirect object as well (“Added planting_count to crops”) or a reason (“Added planting_count to improve performance”) but really, if you can get a verb and a direct object, you’re most of the way there. And it’s certainly better than “WTF!?” or “yay bugfixes!” or “.”, all of which I’ve seen as commit messages.
You’re welcome.
(Of course, if you don’t freeze up when you have to write a commit message, then keep doing what works for you.)