title should say “GitHub.” the precision is worth three characters.
My top requirement for a commit message is that I be able to understand it a month from now.
Hehe yes that is certainly an important requirement!
I wonder how many fit the “[This patch] makes xyzzy do frotz” format; that was house style at a previous workplace.
This article is a good reminder – I had read about the recommended styles for commit messages before, but I need to double down on that again.
I struggle to make brief and to the point commit messages. It’s always too much like spoken language, and I often end up editing the same commit message or code doc over and over.
It feels like a waste of time, I wish I could learn to put my precise thoughts in as few words as possible straight away.
You’re learning and becoming better at it with every edited commit message.
How many have more than 1 line of commit message?
From my testing, I did find that there were about 2 million commit messages with only a single present-tense imperative verb, like “Update”, or “Commit”. Also, I did notice a lot of commit messages with multiple lines while testing stuff out, but can’t give you an exact amount at the moment.
I would answer your question by writing/running a new query, but I racked up about $500 of charges playing with Google BigQuery yesterday, so trying to get that sorted before I run anything else lol…
Those aren’t necessarily imperative verbs - “update” and “commit” are both perfectly good English deverbal nouns.
Haha very true. I guess at that point it comes down to the intent of the developer, which seems impossible to gauge. Imagining a frustrated developer at his wit’s end commanding his computer to “UPDATE!” or “COMMIT!” is amusing though…
What about performing sentiment analysis on all those commit logs?
Haha I’d think most commit messages would be a little too dry/robotic to get a good sentiment reading on? What do you think?
I’m reminded of once reading about a team that set up their computers to take a webcam snapshot of the developer’s expression (face) when a git conflict occurred.
Well… I was bored the other day which led me to just posting this… https://lobste.rs/s/0zxoap/suggested_improvements_for_tool
Another place where the use of imperative mood makes sense is in option descriptions that you get in --help output for commands. It’s often the shortest form, not only in English but also many other languages. And other forms can be clumsier with regard to whether the command, the option or the human is doing the action. It allows you to leave out the subject of the sentence but still have a valid sentence.
Yes. And this reminds me of a comment from Reddit:
“You wouldn’t name a function madeWidget or addedBarToFoo. You’d say make or add. Because you’re not describing what you did. You’re describing what the thing you made does. A commit is a thing you made. Every time someone applies it, it’s going to do something”
Given the free-for-all nature on most Github projects I’m actually very surprised the number you came up with is as high as it is. I would have expected much worse (I’m a strong supporter of following this guideline). If anything there are a lot you might be missing since projects that do have style requirements for commits often also have prefixes (such as Conventional Commits. The most likely projects to stick to mood rules are also the most likely to not make it into these numbers — which just makes the stat even more impressive. Only 45% to go!
Agreed. I touched on the prefixes in my article - I think there is a good chance that they are the biggest source of error in my calculation and would lead to 44% being a low estimate. I may try to add in a regex to account for many of the common prefix formats.
Does anyone think that commit messages using the imperative mood actually have greater value than messages which don’t?
I really just prefer it to be consistent within a repository. Ultimately I end up using the imperative mood in my personal projects because it’s one of the most common, and easiest standards out there to follow.
Yes, I do.
The biggest issue is consistency, but imperative mode fits better in more contexts. It usually doesn’t strike people as an important point when writing a commit message, but when reading them in various contexts there is a lower cognitive load when thinking about what a commit does. When cherry-picking commits, sorting through history building change logs, doing pull request reviews, etc. commits written with short first lines beginning with imperative verbs fit best into the largest variety of context.
git apply "I found a fat-finger mistake"
git apply "Fix typo in readme"
git cherry-pick "Travis makes lots of passes to test the build"
git cherry-pick "Reduce passes required by Travis to test build"
The first examples doesn’t fit well with the concept of cherry-picking or applying a patch. The first one is pretty easy to guess that the commit fixes the mistake, but in the second example how would you even know whether the commit was increasing passes or decreasing them without the proper verb?
I don’t like using the imperative mood. I prefer to use the present tense as in “[This commit] Adds new feature foo”.