logoalt Hacker News

nozzlegear01/21/20254 repliesview on HN

I have a small fish script I use to prompt a model to generate three commit messages based off of my current git diff. I'm still playing around with which model comes up with the best messages, but usually I only use it to give me some ideas when my brain isn't working. All the models accomplish that task pretty well.

Here's the script: https://github.com/nozzlegear/dotfiles/blob/master/fish-func...

And for this change [1] it generated these messages:

    1. `fix: change from printf to echo for handling git diff input`
    
    2. `refactor: update codeblock syntax in commit message generator`
    
    3. `style: improve readability by adjusting prompt formatting`
[1] https://github.com/nozzlegear/dotfiles/commit/0db65054524d0d...

Replies

relistan01/22/2025

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?

show 4 replies
mystified501601/22/2025

That's actually pretty useful. This could be a big help in betting back into the groove when you leave uncommitted changes over the weekend.

A summary of changes like this might be just enough to spark your memory on what you were actually doing with the changes. I'll have to give it a shot!

mentos01/22/2025

Awesome need to make one for naming variables too haha

lionkor01/22/2025

Those commit messages are pretty terrible, please try to come up with actual messages ;)