Ello Ello.

Can you recommend a program with which I can generate commit messages locally? I DO NOT want an LLM local or cloud API. What I want is a tiny or small language model. If I could easily swap or customize the model for each project, it would be better, too. So I could have smaller models for specific projects. I can do the training meself.

Thanks in advance!

  • hendrik@palaver.p3x.de
    link
    fedilink
    English
    arrow-up
    15
    ·
    منذ 6 أيام

    Not aware of such a thing. For the commit message to mean anything, it needs to understand what you did. And that requires some level of “intelligence”. Do it yourself, reference a user story or issue report or use a small large language model.

  • lime!@feddit.nu
    link
    fedilink
    arrow-up
    13
    ·
    منذ 6 أيام

    why generate commit messages? they are notes to yourself about what you have done and why. they don’t need to be more than a single line.

    • aldhissla@beehaw.org
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      منذ 6 أيام

      I’ve once worked on a project where your commits to your dev branch were supposed to be helpful to colleagues for reviews, but they had to be squashed for the feature branch, with comments adhering to the conventional commit “standard”. On the other side of it, there was a horrible pedant of a middle manager, who was rejecting merges based on (debatable) “misformats”.

      This affected billing. They supposedly had some scripts evaluating merge requests, and they’d shrug and say “the script rejected it”. This was before LLMs. Come to think of it, they’re probably replaced by an LLM now, prompted by the customer to “try to defraud and fuck with the workforce on every commit”.

      So to sum up, maybe OP’s in some sort of corporate hell, or maybe they want a bit more than going git commit -m every time.

    • Farooq@realbitcoin.cashOP
      link
      fedilink
      arrow-up
      3
      arrow-down
      4
      ·
      منذ 6 أيام

      they are not notes to meself when there are others in the project. And the commit message is not always one line. Sometimes it’s more. And even if it is one line, it is still annoying to manually type for everything and every change.

      • lime!@feddit.nu
        link
        fedilink
        arrow-up
        10
        ·
        منذ 6 أيام

        but that’s your job. document the rationale of your changes for others.

      • Ephera@lemmy.ml
        link
        fedilink
        arrow-up
        7
        ·
        منذ 6 أيام

        You and your team will have to decide, but in my experience generating commit messages is not particularly useful.

        Because you really just want a short (ideally one-line) summary of the changes. If someone’s interested in the details, they can look at the diff (and hell, have that then summarized by an LLM, if needed). Adding a bullet point list for each concrete change adds a ton of noise to the commit log, which is IMHO not worth it.

        Where long commit messages are actually useful is for documenting things that aren’t written into the code, mainly why you made the change. But since they’re not in the code, the LLM can’t generate that part for you.

        • Farooq@realbitcoin.cashOP
          link
          fedilink
          arrow-up
          2
          ·
          منذ 6 أيام

          I see. didn’t think of this one. Note that there is a commit message, one line, and there is an extended description. The extended description, most of the time, is like you said and an LLM cannot do it. But I was wondering if that one line could be auto-generated. If not for every commit, at least for some common changes. But I will take your word that a Language model won’t be good.

          • Ephera@lemmy.ml
            link
            fedilink
            arrow-up
            1
            ·
            منذ 6 أيام

            I mean, that one line summary is definitely doable for an LLM (not so sure for a small model, but maybe with the right harness).

            The only reason I wouldn’t consider it useful there, or perhaps even harmful, is that I can really recommend knowing the gist of that summary long before you think to commit. You should have an idea of what atomic change you want to make before you start coding.
            Obviously, you’ll likely be wrong and need to make other changes beforehand, but then you can git stash, make the other change and continue on your original objective.

            I’ve had juniors before that really struggled with not getting overwhelmed trying to change everything all at once, and it really clicked for them when I told them to think of their commit message before they start, so yeah.

            Having said that, I have a colleague that’s not too hot with English and probably also has dyslexia, and he just writes the rough message, then has a language model clean up the formulation + typoes. I do think that’s a good use for a language model.

      • farmgineer@nord.pub
        link
        fedilink
        English
        arrow-up
        1
        ·
        منذ 4 أيام

        Wouldn’t a changelog be more meaningful and valuable, then? Even if you are keeping your changesets and PRs small and focused, as one should, it’s still going to be hard to be super useful in a commit message (which some systems may hide or truncate beyond a small character limit anyway).

  • deegeese@sopuli.xyz
    link
    fedilink
    arrow-up
    8
    ·
    منذ 6 أيام

    You might not want to admit it, but you’re asking for a local LLM.

    “Small” is just a euphemism for local.

    • Farooq@realbitcoin.cashOP
      link
      fedilink
      arrow-up
      2
      ·
      منذ 6 أيام

      Well, if a meaningful commit message can be created only with a model as big as 1B parameters, I’m better off doing them meself.

      • deegeese@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        منذ 6 أيام

        “Meaningful” is doing the heavy lifting.

        To make a good commit message it must understand your codebase, and programming in general.

  • KissYagni@programming.dev
    link
    fedilink
    arrow-up
    9
    arrow-down
    2
    ·
    منذ 6 أيام

    A commit message is not supposed to be a summary of the code. It is supposed to gives information that you cannot deduct from the diff. Like:

    • Is there an attached ticket ?
    • Does it produce side effects ?
    • Is it a quick and dirty fix just before the release ?
    • What are the consequence of the modification ?
    • Why you choose this approach instead of another ?
    • Why are you not able to add regression test ? etc …

    The first guy at Cursor that create the feature to generate commit message from diff is just a fucking moron that don’t understand the role of a commit message.

    • aivoton@sopuli.xyz
      link
      fedilink
      arrow-up
      5
      ·
      منذ 6 أيام

      Things I want to see in a commit message before an autogenerated dissection of the diff:

      • What you ate for lunch
      • Were you grumpy this morning
      • Was your cat an asshole and drop something from a kitchen table
      • Is green better colour than blue
      • Did you hurry when typing the commit message
      • afasfsafdas

      I can understand the diff, but I can’t understand your reasoning and anything that gives me an inkling of your mind is better than rewording the diff.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      منذ 4 أيام

      Bullshit. They should also be a summary of the diff. Why would I want to have to read the entire diff to know what the commit is even trying to do?

      • KissYagni@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        منذ 4 أيام

        That’s the role of the commit title, with tags if you follow https://www.conventionalcommits.org/ standard.

        99% of commit description will never be read. Only the title is usefull when you scroll to a git log.

        But, for the remaining 1%, it means you ended up doing a git blame, git bisect or any funky stuff like this to troubleshot a bug. And when you find the commit that introduced the regression, written by some dude that leaved the company 5 years ago and see a description like “Add the whatever method in whatever class that do the stuff explained by the doc written in the file”… Well, thanks bro. But why did you do this !!!

    • Farooq@realbitcoin.cashOP
      link
      fedilink
      arrow-up
      5
      ·
      منذ 6 أيام

      8GB means around 8B parameters. It’s no where near small. I meant the classic language models before LLMs existed. Something which I can easily execute on CPU to generate the commit messages.

      And here, I’m not asking for “what model” rather “what utility” which uses such these models. Finding or training a model is much easier than maintaining such a software and keeping it useful.

      • TehPers@beehaw.org
        link
        fedilink
        English
        arrow-up
        6
        ·
        منذ 6 أيام

        the classic language models before LLMs existed

        Which models are you referring to here? Earlier versions of GPT (like GPT-2)?

        There are small LLMs like Phi 4 Mini that you could look at. Those were part of the “small language model” craze (SLMs).

        If you want meaningful commit messages though, nothing beats handwritten messages. Commit frequently and the messages should be short and easy to come up with.

        • Farooq@realbitcoin.cashOP
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          منذ 6 أيام

          Commit messages are for sure short and easy to come up with, already. The problem’s typing some common stuff every single time.

    • aldhissla@beehaw.org
      link
      fedilink
      arrow-up
      4
      ·
      منذ 6 أيام

      How the hell is 8GB a small amount for a side utility? Are you using LLMs to count to 50?

      • CameronDev@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        منذ 6 أيام

        Its small in the sense it’ll run on basically any GPU from the last decade, rather than high end or specialised GPUs. And there is a 1GB gemma4 model, which is meant for CPU/phones.

          • CameronDev@programming.dev
            link
            fedilink
            arrow-up
            3
            ·
            منذ 6 أيام

            You’re not wrong though, even 1GB is quite lot for writing commit messages, I gave it a quick go, and it takes around 15-30s to analyse a very small diff. Kinda silly for git messages.

            • Farooq@realbitcoin.cashOP
              link
              fedilink
              arrow-up
              2
              ·
              منذ 6 أيام

              Thanks for letting us know. Yeah sure. It’s not worth it. I personally take about 10s to write the commit message. So such a thing will just make it worse.

              • CameronDev@programming.dev
                link
                fedilink
                arrow-up
                1
                ·
                منذ 5 أيام

                For shits and giggles, I had a go at writing a script that could rewrite all the commits in a branch with LLM generated commits. Couldn’t work out how to do the commit changing, tried cherry picking, but it doesnt work well for conflicts (had no idea that was possible). But, I can report timings at least.

                On my M1 16GB macbook air, each commit was summarised in about 10s. So its a plausible approach if you just do all your commits, and then run a script to fix up the messages, go get a glass of water and you’ll come back to automatic messages.

                If it’s of interest to you, I can share the script, its a starting point, but I am pretty ashamed of it :D

  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    منذ 4 أيام

    That simply won’t work. There’s a reason we use large language models - they’re good at generating text. Small language models are not.

  • lemmysmash@beehaw.org
    link
    fedilink
    arrow-up
    2
    ·
    منذ 6 أيام

    Use commit 0 as your initial commit, and then:

    git log -1 --pretty=%s | sed -E 's/^commit ([0-9]+)$/\1/' | awk '{print "commit " ($1+1)}'
    
  • [object Object]@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    منذ 6 أيام

    What is your small lm threshold?

    There are Gemma 4 models that run on phones, is that what you’re looking for?

    To do this well you will need tool calls because just reading the git diff won’t be enough context to do a good job.

    This is probably something you can fine tune, it is getting exponentially cheaper to do this, but without knowing why you don’t want to self host an existing LLM to solve this problem it’s hard to give good advice.

    You can look at smollm3 or nanogpt and nanollama as (dated) examples of how to build such a small model yourself, but they’re still LLMs that run on LLM tools. Smollm has guides to fine tune for your task.

    You could run them with PyTorch directly or something too, if you’re opposed to the full llama.cpp (vllm is even heavier, with very long startup times).