Work / aicommit2
aicommit2
A CLI that asks several AI models for a commit message at once and lets you pick. It works with Git, YADM and Jujutsu, and with Ollama, Claude, Gemini, OpenAI and any OpenAI-compatible API.
- GitHub
- ★ 530
- Works with
- Git · YADM · Jujutsu
- Providers
- 17 built in · OpenAI-compatible
- Install
- Homebrew · npm
brew install aicommit2
npm install -g aicommit2
What it does.
Several models, one list
Requests go to every configured provider at once, and their messages fill one list as they come back. Pick one, edit it in your editor, or ask the providers again.
Git, YADM and Jujutsu
The kind of repository is detected automatically.
A review before the commit
An optional AI code review with severity levels runs before you commit.
A new message for an old commit
aicommit2 rewrite writes a new message for a commit that already exists.
How it is designed.
The request fan-out, the diff compressor and the project config of aicommit2, drawn from its code.
-
One request per provider and model
Each provider fires one request for every model it is configured with, and every request is its own stream. Messages reach the picker as they arrive, so a slow provider does not hold the others. One function gives the number of requests to both the progress counter and the requests themselves, so the two cannot drift apart.
-
Providers load on first use
The registry holds the 17 built-in providers as loaders. A provider’s SDK is imported the first time that provider is used, so a run that asks two of them does not load the other fifteen. An OpenAI-compatible endpoint you configure takes its own path beside the registry.
-
A big diff is cut before it is sent
In the default mode a diff under 100 KB is sent untouched. A larger one loses its metadata headers and its distant context lines, each hunk is capped at 150 lines and the whole diff at 3,000, so a big staged change does not fail at the provider.
-
A repository shapes the message, not the keys
A repository can carry its own .aicommit2/config.ini. Because that file comes from whoever wrote the repository, only content and shape settings are read from it: the locale, the commit type, the prompt, one model per provider. API keys and endpoint URLs are ignored with a warning, the file cannot turn a disabled provider back on, and a prompt path must stay inside .aicommit2/.
-
A failed commit keeps its message
With Git and YADM the message you picked is saved before the commit runs its hooks. If a pre-commit hook rejects the commit, aicommit2 --retry commits the same message later with no provider call. The saved message is removed once a commit succeeds.