A command-line tool that generates git commit messages using a local LLM. It reads your staged diff, sends it to a model running on Ollama, and gives you a conventional commit message — no API keys, no cloud, everything stays on your machine.
When you run bcommit, it:
- Grabs your staged diff (
git diff --cached) - Estimates how large the diff is and picks a processing strategy:
- Small diffs get sent to the model as-is
- Medium diffs go through a filtering step that strips out lock files, generated code, and other noise
- Large diffs get broken down per-file, each summarized individually, then aggregated
- Sends the processed diff to a local Ollama model
- Returns a Conventional Commits formatted message
If Ollama isn't running, bcommit will start it for you and shut it down when it's done. If you don't have the model downloaded yet, it'll offer to pull it.
You'll need Go and Ollama installed.
go install github.com/sidpremkumar/bcommit/cmd/bcommit@latestOr build from source:
git clone https://github.com/sidpremkumar/bcommit.git
cd bcommit
go build -o bcommit ./cmd/bcommitStage some changes and run it:
$ git add -p
$ bcommit
● Analyzing staged changes...
.github/workflows/uat-deploy.yml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
● Ollama server is not running. Starting it...
✓ Ollama server started (will shut down on exit).
● Generating commit message...
feat(.github/workflows): add pre-create SSH keys for gcloud in UAT deployment workflow
[Copied to clipboard]
[a]ccept [e]dit [r]egenerate [q]uit: a
✓ Committed: feat(.github/workflows): add pre-create SSH keys for gcloud in UAT deployment workflow
● Shutting down Ollama server (we started it)...
✓ Ollama server stopped.
From the interactive prompt you can:
- a — accept the message and commit
- e — open it in your
$EDITORto tweak it - r — throw it away and generate a new one
- q — quit without committing
-c, --commit Auto-commit without the interactive prompt
-p, --print Just print the message to stdout (useful for scripting)
-m, --model string Use a different model (e.g. qwen2.5-coder:7b)
-t, --type string Force a commit type (feat, fix, refactor, etc.)
--hint string Give the model extra context about what you're doing
-v, --verbose Show token counts, tier selection, and timing info
Skip the interactive prompt and commit directly:
bcommit -cGive the model a hint about what you were working on:
bcommit --hint "migrating from REST to GraphQL"Force a specific commit type:
bcommit -t fixUse a larger model for more complex diffs:
bcommit -m qwen2.5-coder:7bJust print the message (pipe it somewhere, use it in a script, etc.):
bcommit -pbcommit stores its config at ~/.config/bcommit/config.json (or $XDG_CONFIG_HOME/bcommit/config.json).
View current settings:
bcommit configChange a setting:
bcommit config set model qwen2.5-coder:7b
bcommit config set auto_commit true
bcommit config set copy_clipboard false| Key | Default | Description |
|---|---|---|
model |
qwen2.5-coder:3b |
Ollama model to use |
auto_commit |
false |
Skip the interactive prompt and commit |
copy_clipboard |
true |
Copy the generated message to clipboard |
bcommit ships with qwen2.5-coder:3b as the default — it's a ~1.9GB code-specialized model that runs well on most machines. You can swap it out for any model available through Ollama.
MIT