Live data from Hacker News

The Lost Art of Commit Messages

seyhan.me

41–50 of 61 posts

Re: The Lost Art of Commit Messages

#41
post #32

This is one of the cases where I think AI can help. 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. A quick google gave me several projects: - https://github.com/Nutlope/aicommits - https://github.com/insulineru/ai…

$workplace tried this and it is utter garbage (so far) even with full access to the diff & context.

Just as you'd expect from an LLM, it hallucinates a description that overfits the average commit message. It doesn't make a good summary of what changed, and most importantly (though I don't expect it to) why it changed, which is what I need in a commit message.

Re: The Lost Art of Commit Messages

#42
I don't care, as long as a commit which fixes a crash, compiler error or test failure quotes the errorv. This helps searching for issues, and also helps later if you find they mis-diagnosed the problem.

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.

Re: The Lost Art of Commit Messages

#43
post #33

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…

The author is working in an environment where, left to their own device and allowed free form messages, programmers write the three word sentences shown in the blog post. This is the downside of the variation in style across contributors. It works if people want to build something, and not just do the minimum. Open source projects frequently have no such limitations. But I am sad to report that some people appear to…

  Address structural issue with code contributions
  
  In some cases, it's possible to end up with commit messages that carry
  very little value. Unfortunately, while the minimum is clearly
  insufficient, it is possible to "expand" the minimum into a specific
  format without substantially improving the quality of the commit
  message. For example, a substantial refactor can easily just be
  described as a list of the changes that it included, rather than a
  rationale for why it was done (which is not readily apparent from the
  change itself).
  
  In the long run, problems involving people can be improved by process,
  but cannot wholly be solved by them. Pernicious failures need to be
  acted upon directly. Demonstrating the value of good commit messages is
  often a better driver of improvements than a template that is a chore
  to fill out.

Re: The Lost Art of Commit Messages

#44

Earlier quoted context omitted.

> Having commits prefixed by "chore:" or "docs(ui):" aren't that useful. I don't use those for humans, I use those for tooling, such as semantic-release. The human-readable bits come after that. https://semantic-release.gitbook.io/

I always thought we have tags for tooling.

And the rest of the message. And git-notes.

Reducing the human-readability of the most human-presented part of the commit, to make it easier for the can-do-billions-of-operations-a-second machine, seems backwards.

Re: The Lost Art of Commit Messages

#45

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…

  Also, reconsider column-based hard-wrapping entirely,
  and consider wrapping mostly on punctuation,
  or other reasonable opportunities when it gets a bit long
  and you don’t really want to insert punctuation.

  This is not without its drawbacks and limitations—
  most software when rewrapping won’t cope with trailing em dashes,
  and you’ll end up with extraneous spaces when the lines are merged,
  even though this is *always* how wrapping has worked around dashes.

  Over time, this will definitely influence your writing style.
  Your sense of æsthetics will push you to reword sentences,
  because otherwise the edge is too ragged for your liking,
  and at some point you’ll see a pattern in a paragraph,
  and feel an uncontrollable urge to continue it,
  and you’ll waste a bunch of time tweaking,
  and maybe no one will appreciate it.
  But you’ll appreciate it.
  It’ll be fun.
  Mostly.

  But seriously, you *will* become more aware of things like clause length,
  and your writing will probably improve.

  And after writing verbosely for a long time,
  you’ll focus on concision,
  and that’ll be another challenge.
  And it’ll be fun too.
  Mostly.

  Then probably someone will take over your pet docs project,
  and mandate an autoformatter that rewraps it to 59 columns.
  Stubbornly, in the quiet of your mind, you’ll make it work.
  It’s a greater challenge, but you won’t lack determination.
  Style guides come, and style guides go; when this one goes,
  your lines can remain the same, needing no fixing, perfect.

  —⁂—

  And really, just look at how the last paragraph of the parent comment looks,
  before and after:

      Finally, commit comments definitely should have jokes in them. This is
      actually more critical than wrapping them at 72 characters.

                                      —⁂—

      Finally, commit comments definitely should have jokes in them.
      This is actually more critical than wrapping them at 72 characters.

  Much more beautiful, is it not?

Re: The Lost Art of Commit Messages

#46

I prefer: 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.

You can actually specify multiple types in one go usually.

The actual purpose is mostly for tooling to help generate release notes.

Re: The Lost Art of Commit Messages

#47
post #15

--message "wip" Why do we care about commit messages? I only read them when rebasing.

They are incredibly helpful when you are trying to find where a bug was introduced, and trying to figure out why some piece of code is the way it is.

If you can’t figure it out based on the git blame and git diff, the code is incredibly unreadable. A comment in the code, or simply writing better readable code seems like a better investment.

Besides, a few passes refactoring and your git history is ruined. No way you’ll find the original commit within any reasonable time frame.

If I move the code to another function, your original commit message will be hard to trace. If the code was commented, the comment would have been moved along. If the code was readable, you don’t need the comment or the commit message.

Re: The Lost Art of Commit Messages

#48
post #18

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…

This isn't prose, it's poetry.

A lot of the best prose is poetry.

Re: The Lost Art of Commit Messages

#49
post #33

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…

The author is working in an environment where, left to their own device and allowed free form messages, programmers write the three word sentences shown in the blog post. This is the downside of the variation in style across contributors. It works if people want to build something, and not just do the minimum. Open source projects frequently have no such limitations. But I am sad to report that some people appear to…

In my experience, people write overly short commit messages when they're writing too many commit messages. The solution is usually not to teach people to write better commit messages (although that's also good), but to teach them how to group and bundle commits together to create a meaningful standalone patch.

One of the easiest ways to start there is to adopt PR-based review systems, where any number of commits can get pushed to a git repository and then reviewed as a single block. This is fairly inflexible, but it is very simple to get started with (no need to learn any special rebasing commands, just add, commit, add, commit, push). Most git forges allow you to do squash merges, so everything in the PR will become a single commit, usually with the PR description as a commit message. Then you can refine the commit and commit message during the review process.

There are better tools out there, but in my experience, this is the quickest way to get started for most teams, especially as you're probably already using a forge that allows you to do all of this already.

Re: The Lost Art of Commit Messages

#50
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.

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.

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.

Post reply on HN