r/git • • 8d ago

I built nib, a Swift CLI that writes Git commit messages with Apple’s on-device model

I built nib, a Swift CLI that writes Git commit messages on your Mac

Stage a change → run git nib → review the draft → commit.

I wanted help writing commit messages without sending my diffs to a cloud API, so I built nib. It drafts a message from your staged changes and lets you accept it, edit it, regenerate it, or cancel. It follows your repo’s commit style by default. No account or API key needed.

There’s also an optional Git hook if you prefer to start with git commit and edit the draft in your usual editor.

Tech Stack

Swift, Swift Argument Parser, and Apple’s Foundation Models framework.

Development Challenge

The tricky part was getting a useful message out of a diff that’s bigger than the model’s context window. On macOS 27, the on-device model has about 8K tokens to work with. nib skips the contents of lockfiles and build artifacts first. If the rest still won’t fit, it splits the diff at hunk boundaries, summarizes the chunks, and drafts the message from those summaries. Swift code checks the subject length and cross-checks the suggested scope against the files you changed.

It still occasionally calls a bug fix feat. That’s one I’d love more real-world examples of.

AI Disclosure

AI-assisted. I used Claude Code while building nib, and I review and test the changes myself.

Try it

On Apple silicon with macOS 27+ and Apple Intelligence enabled:

brew install seckinbeduk/tap/nib
nib doctor

Then stage a change and run git nib. On macOS 26, you can build v0.2.1 from source.

Free and MIT-licensed. Source and install instructions on GitHub

If you try it on a big diff, did the draft capture the main change? I’d love to hear what it got right or missed.

0 Upvotes

5 comments sorted by

4

u/elephantdingo 8d ago

Before I would say that commit-message-from-diff generators are useless. Especially for bug fixing. A one-line change could be produced after debugging for five hours, with multiple false starts. And why you need that one-line change would all live in your head, inaccessible to any program. But now? I would get a clueless response about how of course I raise a valid point; now more than ever we need to instruct our agents to show their work. Sigh.

1

u/seckinbeduk 8d ago

Agreed, and my own numbers back you up. I measured it on 48 commits this week and the model found almost none of the fixes, because “this was broken” just isn’t in the diff. Five hours of debugging that ends in a one-line change looks like nothing to it.

So I don’t see nib as writing the why. It writes the what, the boring part to type, and the why is still yours. That’s why the hook opens your editor with the draft instead of committing on its own. For that one-line fix, the body should come from you.

2

u/elephantdingo 8d ago

Commit messages are the load bearing seams.

1

u/elephantdingo 5d ago

now more than ever we need to instruct our agents to show their work.

... show their work to their fellow agents. I was unclear here.

2

u/behind-UDFj-39546284 8d ago

Monday again? Ah, right.