Commit Description as a Thinking Tool

(yedhu.me)

59 points | by yedhukrishnan 1 hour ago

10 comments

  • arialdomartini 17 minutes ago
    On top of this, it pays off to write the commit messages before the code

    https://arialdomartini.github.io/pre-emptive-commit-comments

    • drdaeman 7 minutes ago
      Jujutsu is perfect for that - you create new changeset upfront, providing message at the same time (which can be later amended as needed). Feels so much more logical to declare the topic first, rather than come back to some accidentally uncommitted changes and wonder what was doing there.
  • WD-42 19 minutes ago
    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.
  • zahrevsky 53 minutes ago
    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 21 minutes ago
    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.

    • cerved 18 minutes ago
      why not both? notes are pretty ephemeral by design
  • seunosewa 28 minutes ago
    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.
    • loopmonster 25 minutes ago
      If the second LLM is just describing the content of the commit doesn't that defeat the purpose of the description, to capture the context that doesn't make it to the code?
      • seunosewa 18 minutes ago
        The second LLM is prompted to actually research the code, not just the diff, with fresh eyes to figure out what it does and why, before writing the commit message.
    • dennisy 26 minutes ago
      This would have an even greater loss of the “why” context the author is describing in the piece.
    • bigmadshoe 21 minutes ago
      This makes no sense to me. The code is already self-documenting if written well, and all you need is a one line commit message to summarize that.

      Doesn't the original conversation at least retain the context about why the change was made? A different LLM literally has no way to tell why you made this change besides guessing from the codebase and git history.

      • seunosewa 6 minutes ago
        If a change makes sense, a different frontier model can usually figure out why it was made from the code alone. I take that as a signal that that the commit is good.

        I believe they can do this due to having millions of public pull requests and github issues in their training data.

      • sigbottle 16 minutes ago
        the mechanism is self documenting; context is not unless you pollute all your files with an ADR's worth of alternatives.
    • cerved 24 minutes ago
      If you ask an LLM to write a message that explains "the why", it'll make up a why.
    • _verandaguy 26 minutes ago
      The blog post is advocating against this.
  • kccqzy 56 minutes ago
    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.
    • sublinear 22 minutes ago
      To stay concise, I think bullet trees are the best. I've never had to make exceptions to this format.

      Top level groups high-level concerns (optional). Below that (required) are short distillations of those concerns answering "why". Below that are descriptions of "what" was/wasn't done. A final optional level digs into deeper implementation detail.

      The vast majority of my bullet trees are just those two required levels. Each commit message is rarely more than 10 or 15 lines long, and people really appreciate them. I appreciate them too since I'm the most likely to read them.

  • FLeXMurphy 1 hour ago
    This has been a topic belabored since commit messages were a thing. CVS? RCS? Probably earlier.
  • tombert 1 hour ago
    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.

    • blmarket 58 minutes ago
      I would encourage to speak up - especially when we're blaming bad code(not a person) being bad. Ultimately senior engineers are ones who can blame bad things with a compelling reason.

      Happy to read good reasoning why it's fucking blow-up.

      • tombert 41 minutes ago
        This was a long time ago so I can't remember the details, and I was decidedly not a senior engineer at the time. That said, if I remember correctly there was something a bit finnicky with how `cfquery` in ColdFusion handled the automatic caching stuff.
  • sublinear 41 minutes ago
    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.

  • helloimgkeep 51 minutes ago
    [dead]