logoalt Hacker News

relistan01/22/20254 repliesview on HN

Interesting idea. But those say what’s in the commit. The commit diff already tells you that. The best commit messages IMO tell you why you did it and what value was delivered. I think it’s gonna be hard for an LLM to do that since that context lives outside the code. But maybe it would, if you hook it to e.g. a ticketing system and include relevant tickets so it can grab context.

For instance, in your first example, why was that change needed? It was a fix, but for what issue?

In the second message: why was that a desirable change?


Replies

lnenad01/22/2025

I disagree. When you look at the git history in x months you're gonna have a hard time understanding what was done following your example.

show 2 replies
rane01/22/2025

Most of the time you are not able to fit the "Why?" in the summary.

That's what the body of the commit message is for.

nozzlegear01/22/2025

Typically I put the "why" of the commit in the body unless it's a super simple change, but that's a good point. Sometimes this function does generate a commit body to go with the summary, and sometimes it doesn't. It also has a habit of only looking at the first file in a diff and basing its messages off of that, instead of considering the whole patch.

I'll tweak the prompt when I have some time today and see if I can get some more consistency out of it.

zanderwohl01/22/2025

> The commit diff already tells you that.

When you squash a branch you'll have 200+ lines of new code on a new feature. The diff is not a quick way to get a summary of what's happening. You should put the "what" in your commit messages.