<p><pre><code> Reject commit message suggestions
When working on large software projects, commit messages that follow
the format suggested by the author rarely provide additional value.
Having commits prefixed by "chore:" or "docs(ui):" aren't that useful.
Instead, some of those 50 characters can be used for more descriptive
titles. Commit messages are often the best and only context available
when bisecting a bug, so bullet points only really make sense when
making a list. Prose works just fine.
Writing styles vary across contributors but it's much more useful to
get *anything* from someone in their preferred format than nothing at
all because they are frustrated with rules. Some committers do have a
special "committer voice" that they use when describing complex changes
in a commit message. For example, the text here is slightly abridged
and focuses less on the first person than what is typically expected.
This evolves naturally from writing these.
Finally, commit comments definitely should have jokes in them. This is
actually more critical than wrapping them at 72 characters.</code></pre>
I quite like my current system.<p>One word naming the topic or area or system that was changed, then colon separated with a very short sentence giving a summary of the changes, then two lines later (if necessary), a bullet point list of the most important/noteworthy changes, then an explanation for why a thing was changed (if any change in the commit warrants it).<p>Honestly, I know most people won't go beyond the first line, but I do find the rest of it very helpful for my own work if I have to go through the commits sometime in the future.<p>It also helps that most of it is optional and I decide on a case by case basis whether just the first line is sufficient or I need the whole thing.<p>I see in the comments people questioning the purpose of a bullet point list, but it actually is helpful. I don't want to have to check the diff for every single commit if I don't have to. It's time consuming. If a commit message can tell me immediately if it touched something I'm interested in, that's a big time and effort and mental bandwidth saver.<p>Example:<p>auth: Refactored and fixed edge cases<p>- Fixed incorrect handling of token groups<p>- Added role enum to replace static strings
You get some of this for free if you create branches and squash merge them when finished. Without needing to think much about commit message, just a few words per commit is enough. This is good enough for me and I don't need to waste any time thinking about it.<p>Example commits of something I worked on a few days back:<p><pre><code> $ git l feature/character-selection
c54825f 3 days ago Robert Schaap (feature/character-selection) Simplify color picker, fetch current color
d512569 3 days ago Robert Schaap Fix recolor for female, clean up files
6d05ce4 3 days ago Robert Schaap Add color picker to change shirt color
441180b 3 days ago Robert Schaap Show male in editor
17045dc 3 days ago Robert Schaap Remove old character
95772ff 3 days ago Robert Schaap Add characters
</code></pre>
Then when I squash merged it I ended up with this commit message:<p><pre><code> $ git show HEAD~1
commit be50e0d701d565cebdf4f29e0c9d8030a1a8faf7
Author: Robert Schaap
Date: Mon Mar 24 21:29:20 2025 +0100
Character selection (#14)
* Add characters
* Remove old character
* Show male in editor
* Add color picker to change shirt color
* Fix recolor for female, clean up files
* Simplify color picker, fetch current color</code></pre>
These example commits seem like pretty bad commit messages to me. They are just a summery of the changes (something a motivated reader can rediscover by reading the diff), while leaving out the why, which will be lost to history if not documented.
A dev culture that produces nothing but <i>wip</i> and <i>fix bug</i> commits (frequently adding unrelated refactors) will continue to produce noise but prefixed with <i>chore(code): fix bug</i>. I fail to see the benefit behind this and conventional commits.<p>I do not understand why people insist on trowing inane technical solutions at social problems. It doesn't work.
Similar to <a href="https://www.conventionalcommits.org/en/v1.0.0/" rel="nofollow">https://www.conventionalcommits.org/en/v1.0.0/</a> right?<p>I wouldn't say its a lost art... we do this at our company
What about Gitmoji? [0] Didn't get much love when discussed here[1] but fun concept. At least it makes you think about the commit message, which is better than not. And each commit having one selected emoji forces you to make one commit per improvement, so you can't bundle stuff together.<p>[0]: <a href="https://www.bekk.christmas/post/2019/11/gitmoji-yay-or-nay" rel="nofollow">https://www.bekk.christmas/post/2019/11/gitmoji-yay-or-nay</a>
[1]: <a href="https://news.ycombinator.com/item?id=21760021">https://news.ycombinator.com/item?id=21760021</a>
Depends. Sometimes a one-liner or a reference to a ticket is enough.<p>There are times when I make a one-line change and write a paragraph or two explaining why it had to be done. But these kinds of things often drown in the noise of a dozen other changes. If that one was important enough, I will reference it in an ongoing discussion or documentation, or at least include "read below:" on the first line.<p>I usually see people include a more elaborate commentary with the pull request. If the changeset is good but the series of individual commits is a bit messy, just merge by squashing.<p>(Also: this comment is meta.)
The quality of commit messages depends on context. The author seems focused on bringing order to long freestyle messages, presumably for the purpose of accreting a rich but readable history log in long-lived branches, but not all commit messages are like that.<p>For example, when typical commits are about solving or implementing some support ticket, issue, new feature etc. that is documented elsewhere correct references are far more important than classification of the commit type or descriptive details; special commits (refactoring, chore, docs etc.) are easily noticeable because they don't reference a specific issue and many details are better omitted for the sake of deduplication.<p><pre><code> fix(ui): correct alignment on dashboard widgets
- adjust CSS flex properties
- test on multiple screen sizes
Fixes #204
</code></pre>
could be (on one line, easier to read in a massive log, and without redundantly describing the problem with misaligned widgets)<p><pre><code> #204 - adjusted CSS flex properties of dashboard widgets; tested on multiple screen sizes
</code></pre>
or maybe, depending on what is expected to be explained in issue #204 or not, more technically precise:<p><pre><code> #204 - same CSS flex properties for all dashboard widget DIV elements; tested on 800*600, 1880*960 and 2900\*1600 browser windows but not on the standard smartphone emulators</code></pre>
I don't care, as long as a commit which fixes a crash, compiler error or test failure <i>quotes the errorv</i>. This helps searching for issues, and also helps later if you find they mis-diagnosed the problem.<p>Other peeve: quote the core of the bug report you're closing, so when GitHub inevitably goes away/turns evil/starts charging, you don't lose half your knowledge. The git tree should always stand alone.
I second the Angular-style git commit message convention (<a href="https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md" rel="nofollow">https://github.com/angular/angular/blob/main/contributing-do...</a>). Though, it is also art that I have lost.<p>On a lighter note, I recommend "8 Types of Commit Messages That Show He's NOT the Man for You" <a href="https://web.archive.org/web/20210606005031/https://www.codemopolitan.com/8-commit-messages/" rel="nofollow">https://web.archive.org/web/20210606005031/https://www.codem...</a>
I'm not sure I'm entirely on board with this particular format, but I do agree with the larger point of well-crafted commit messages - and commits, for that matter - being an important quality feature in a project.<p>I'd posit that well-structured commits are principally for the benefit of the reviewer of the code. Order your commits in a fashion that makes sense narratively, and give them meaningful commit messages. Use interactive rebasing liberally if need be to accomplish this goal.<p>As a reviewer, you are well within your rights to decline a PR that consists of a single non-meaningful commit message and a +/- 1000 lines diff. Effort is expected from both parties in checking in code.
This is one of the cases where I think AI can help.<p>Two usecases I can think of: non-native English speakers and ADHD developers.
For those groups, having some tool that autofills the first draft of the commit message (that you can then modify) would probably improve their overall commit message quality.<p>A quick google gave me several projects:<p>- <a href="https://github.com/Nutlope/aicommits" rel="nofollow">https://github.com/Nutlope/aicommits</a><p>- <a href="https://github.com/insulineru/ai-commit" rel="nofollow">https://github.com/insulineru/ai-commit</a><p>I'm sure there's more.
This focuses on the format of the git message, but I would argue what matters more is the content.<p>The most important thing to convey in a git commit message is the why, not the what or how.<p>The title should be a short summary of the change (the what), so that it can easily be searched for.<p>The description should explain why this change needed to be made. The how and the what can be determined by reading the code. But more often than not, explaining the why helps to clarify intent so that future readers can determine if your rationale still holds.
>while pushing changes that could rival a novel in length<p>How is distilling a novel down to a short description and 2 points any better? This format is too limiting.
And please include the why.<p>From the article: "- adjust timeout settings to prevent crashes". Include the details of why the timeout setting lead to crashes; what were the inputs and the cases that caused this.<p>This lets us decide whether the fix stays or goes the next time there is an issue in the same piece of code, or your commit broke something unrelated - the person fixing it needs to know _why_ you changed the code.
I prefer:
<short description>
<BLANK LINE>
<Detailed information>
<BLANK LINE>
<footer><p>Using a type is to contrived, because your commit will often include e.g documentation and a feature. Splitting them for the sake of following this pattern makes no sense.
I rarely read the commit messages.
It's often faster to just read the code than an obscure description, I'd rather have a small sentence that summarizes what the diff is doing than a technical paper explaining every change in the commit. I don't read pass the title.
I'd also consider that this will become increasingly important in the age of LLMs. Want Cursor to one-shot a change? Dollars to donuts the agents of the future will perform a lot better with well-reasoned, well-documented commits to use as reference.<p>On the other hand, job security?
One of the best things about Gerrit - besides stacking and turn-by-turn review - is how it emphasizes good commit messages by making them part of the process.<p>Each commit becomes one "unit of review", and the commit message can be reviewed just like the code changes.
Do people really gain as much time from being able to read these long messages as they lose in writing them?<p>I don't think my team would.<p>Did the author measure this ? If not, he's the monkey.
> <i>Commit messages are the narrative of your project's history. They help others (and your future self) understand why changes were made, making collaboration smoother and debugging less of a nightmare.</i><p>Yes. And yet:<p>> <i>- Keep each point brief and focused.</i><p>> <i>- Use bullets (-) and avoid lengthy explanations.</i><p>No, they lost me there. You often can’t tell the necessary narrative in a single sentence, and you frequently can’t explain why changes were made briefly, and I strongly refute that “avoiding lengthy explanations” should be a goal in commit messages.<p>I exceed ten lines very frequently, and when working professionally I’ve tended to exceed fifty lines at least twice a year. Coworkers have commented favourably on my commit messages, as unusually useful, and some have even lengthened theirs more often after experiencing them.<p>I don’t know what my record is, but it was more than 300, though that was as part of a long-lived refactoring branch that I was needing to rebase every week or two for six months as I continued working on it, migrating from an in-house concatenation-and-#ifdef module builder to ECMAScript Modules, and I was maintaining the dozens of commits meticulously, some regenerated automatically and some requiring manual effort, and so I was detailing the semantics of the changes across a large number of files, so it might not count quite so much. But I’ve done over a hundred a few times for other reasons. Keep your mind open, and look at the longest commit messages in popular repositories, and you’ll find there’s a lot of scope for very long commit messages.<p>—⁂—<p>I loathe Conventional Commits. It saps the art out of the commit message, the tags are frequently badly applicable, the benefits are negligible to negative (changelogs <i>shouldn’t</i> be generated from commit logs—they should be their own thing), and they’re simply ugly.
nit: the author proposes "short descriptions" like "fix null pointer exception in payment module" and "refactor data processing pipeline", however "fix" and "refactor" are already in the "type" part of the commit message. Possibly, "payment module" and "data processing pipeline" can (should?) be extracted from the "scope" element. The characters left over after the type and scope can be used smarter.