Need help?
<- Back

Comments (59)

  • WD-42
    Writing is thinking in every situation, not just limited to commit messages. This is a fact that I'm concerned people are forgetting, or worse never understood to begin with.
  • pnt12
    I agree with the article, but I like to write, while lots of people just see it as a chore.To people who don't like to write a ticket or PR description, the AI text is better than nothing.
  • arialdomartini
    On top of this, it pays off to write the commit messages before the codehttps://arialdomartini.github.io/pre-emptive-commit-comments
  • evnp
    > When the AI doesn’t know the ‘why’ part, it comes up with its own reasoning. I find that dangerous. When we read that later, it may not make sense, because the real reason was completely different.Even more dangerous: when the text _does_ make sense, despite being detached from reality.
  • kccqzy
    Long ago I changed the default commit message to include headers “Why?” and “How?” to remind myself that I need to explain why a change is made (what this article focuses on), and how it is made (different implementation approaches considered). I followed this format for a long time. I was in the top 1% for commit message length at the company.Tangent: I once worried about things breaking when commit messages got too long. I tried really long commit messages and nothing broke: https://github.com/kccqzy/long-commit-messages/commit/ccfda4...
  • dkarl
    I was forced to give up on commit messages long before AI, because other people were so bad at them that I happily agreed that all PRs should squash commits.At least then the squashed messages were usually pretty decent. But then people started using AI (or AI started using people) to create absolutely massive commit messages that are impossible to skim in git blame and overall very bad for human consumption.AI has made massive strides in virtually every other way. Why do they continue to write in a wasteful, human-hostile way?I think we'd have to be be very naive not to suspect that this is intentional. AI companies have a stated goal of replacing humans in the software development process, and they're actively making the process itself inhospitable for humans.They are injecting massive amounts of text into their customers' development process, which then becomes tokens that their customers will then pay them to process over and over again. It's like a CO2 scrubber that emits CO2.
  • jamietanna
    I'm resisting linking to several posts I've written on these lines before - I very much agree that - at least personally - writing the commit message helps me work through what's changed and most importantly why.When AI writes the code for me, I then end up still writing the commit message so I can take ownership of the change myself, make sure I can explain why the change was made and see if there's any missing context that may lead to a different resultI did find that distilling some of my style choices to a `commit-style` skill helps when an AI writes a commit message (for me to rewrite) to be not quite as generic, but it's still needing my ownership to get it right
  • flopsamjetsam
    I sometimes use the AI prompt to do a similar thing: I'm struggling with a problem, or putting my ideas down in a coherent manner, so I write a prompt, and in doing so the idea crystallises for me. I've tried doing this just in a text editor, but there's something about having the next action be "submit this to X" that clicks my brain into higher gear.I suppose it's very similar to drafting a letter or an email to someone.
  • zahrevsky
    I sometimes struggle to decide whether to put an explanation in a commit message, in the docs (say in an ADR). I tend to save everything as docs because files are a more “universal” interface, so to speak. They’re in plain sight and harder to miss.I guess the main advantages of Git history are that it’s (1) uneditable and (2) directly linked to a specific commit.
  • dmtry
    I like git-notes (https://git-scm.com/docs/git-notes) for this sort of annotations and context. It's a nice balance - adjacent to commits, follows branch structure, easy to instrument, doesn't muddy the commit history.Being able to stick a bit of directive text somewhere durable at any point in time has been surprisingly convenient for steering LLMs, as well.
  • seunosewa
    I use a different LLM family to review commits and write detailed descriptions. If a commit was written with Fable/Opus, I use Sol/Astra to write a well reasoned commit message. If the message doesn't match my intent, then that triggers a manual review.
  • tombert
    Tangential, but very early in my career, back when I was still using SVN at work, I used to write all my commits in either limerick or haiku, usually smuggling in some curse word(s) with some cheeky message in there. I was convinced that no one actually read them and I could get a laugh out of it.I did this for months without anyone noticing, and eventually my manager schedules a very awkward meeting asking me why I wrote saying “cfquery fucking blows sometimes”. I had to sheepishly explain that I thought it was funny and then I stopped doing that and my commits became much more utilitarian and much less fun.
  • FLeXMurphy
    This has been a topic belabored since commit messages were a thing. CVS? RCS? Probably earlier.
  • cerved
    Claude tends to just narrate the change when it writes the commit message. Which is not very interesting. Anyone can read the diff and figure out _what_ it does. The interesting is why.So I've been instructing Claude to commit like Jeff King.At first, Claude would mainly just cosplay Peff. Emulate the prose and not the process. Over the last few months I've been iterating on it and now Claude writes vastly better commit message than by default.Initially, Claude would produce A LOT of plausible sounding reasons the LLM "thought" made sense. Instruct an LLM to give reason and it'll give you reasons -- whether they are real or not. After trying to instruct it not to lie, make shit up etc (which did not work) I instead started forcing it to articulate the source of the rationales. Especially which claims where unsubstantiated, and this seems to have helped a lot.Then I instructed it to do some thorough investigation before it commits.Start by writing a brief that gathers different "evidence" that underpins a change. The diff itself. The surrounding context. A bit short git log. A blame on the touched lines to see what previous commits touched this code and for what reasons.Once it's done the agent has to tag each claim according to a category. I.e. what claims are attributed to the change itself (the diff), the inciting incident (gathered from session or if missing, by follow-up questions), what's inferred by the model (unsubstantiated claims.)Only after this supersize is it tasked with writing a commit message given this brief. Or to ask follow-up questions if there's only unsubstantiated claims or gaps in the brief. Furthermore, it is tasked with writing a note to detail assumptions it has made and, or other relevant bits of information that are not commit message worthy, but possibly still interested in noting down. Decisions made. Options not taken. Possible rationales for the change that didn't make the cut.All of this tends to make pretty good commit messages. Not perfect, but a good starting point.Right now my biggest challenge is finding instructions to write the Goldilocks message. Not too brief and not too long. Instruct it to be clear and concise and relevant information gets left out. Say nothing and get a Dostoevsky novel. At least when it writes too long messages it's easy enough to go in afterwards with a `git history reword` and take out the axe.One of the biggest upsides has been, just as when you read a human that writes commit messages like this, is spotting misunderstandings. Several times I've spotted gaps in the reasoning of the message that doesn't match reality, and caught mistakes. A bit like when you use plan mode.
  • ajuc
    The comments and commit messages AI writes is often worse than useless, it's misleading, because it spreads the (very likely to get outdated) implementation details from one place to another.I'll ask AI to write integration between 3 services, and it'll write the class names from the service A in comments in service B and C if I'm not careful.
  • sublinear
    This problem has nothing to do with git.The journaling of any iterative process requires clear notes that answer "why?" for each step. This is what will guide future maintenance.Writing code faster than you can digest and explain it is at odds with this. You will incur runaway technical debt. This was already a problem long before the LLM era.It is nice that more people are finally realizing this, but I'm still waiting for when we start speaking in generalities again and get over all the hype. Nothing ages writing faster than bringing up the specific tools.
  • einpoklum
    > Now we are in the era of agentic coding, where everything from code to commit descriptions is written by AI.No, we are not. Sure, there is a lot of slop-coding/vibe-coding going on, but not much of it in serious code. In my experience and to my knowledge.Of course, I encounter the opposite problem with humans: They often don't bother to write proper commit messages; and many tend to squash them in favor of giant single-commits which just say "Implemented feature #123".
  • kayashaolu2
    [flagged]
  • helloimgkeep
    [dead]
  • JaumeGar
    [flagged]