aicommit2 CLI
aicommit2 writes commit messages for Git, YADM and Jujutsu from the diff via several AIs at once and lets you pick the best
- 532 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- Sends the diff with your code to cloud AI providers if you connect them
- Runs git commit itself after confirmation and commits without asking in --auto-select and --confirm modes
- Stores provider keys in local config and can install a git hook that runs on every commit
Install
- Works in
Manual install
npm install -g aicommit2Alternatively brew install aicommit2 or Nix. Then aicommit2 setup to configure providers.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- Sends the diff with your code to cloud AI providers if you connect them
- Runs git commit itself after confirmation and commits without asking in --auto-select and --confirm modes
- Stores provider keys in local config and can install a git hook that runs on every commit
This is third-party code. Review the repository files before installing.
What it does
aicommit2 is a Node.js command-line program that proposes commit messages from your staged changes (the diff). It works with Git, YADM and Jujutsu and detects the system itself. Requests go to several AI providers at once and you pick the best message from a list. Providers include OpenAI, Anthropic, Gemini, Mistral, Codestral, Cohere, Groq, Perplexity, DeepSeek, OpenRouter, GitHub Models, Bedrock, Ollama and any service compatible with the OpenAI API. The Claude Code, Copilot SDK and Gemini CLI modes run the CLIs of those agents installed on your machine; Claude Code uses your Pro or Max subscription. Message formats are conventional and gitmoji. Flags set the language with --locale, the number of variants with --generate, a custom prompt with --prompt, file exclusion with --exclude, a no-commit mode with --dry-run and --output json for LazyGit integration. It works as a prepare-commit-msg hook, rewrites the message of an existing commit with aicommit2 rewrite and runs a structured code review with severity levels before committing. By the authors' claim diff compression saves 30 to 60 percent of tokens, and a watch mode creates commits as changes appear.
Who it is for. Developers who want to automate commit messages, compare variants from several models and optionally use an already paid Claude Code subscription for it.
Good fit when
- You want a commit message from the git diff fast in conventional or gitmoji format
- You want to compare messages from several models such as Claude and Ollama and pick one
- The repository is managed with Jujutsu or YADM and you want the same tool
- You want to wire generation into LazyGit, a git hook or pre-commit
Not a fit when
- The diff holds confidential code that must not go to cloud providers: then only local Ollama fits
- Commit messages must be written by hand to an internal standard that a prompt cannot express
- You need an agent that makes edits itself: the program only produces messages and reviews
Example request
Generate three conventional commit message variants for the current changes with aicommit2 using --dry-run and show themLimitations
- The Claude Code, Copilot SDK and Gemini CLI modes are marked Preview and need the matching CLI installed and authorized.
- Cloud providers need keys through aicommit2 setup or the config, and costs follow the provider's tariff. The --generate flag with many variants spends more tokens.
- Diff compression and exclusion save tokens, but files from --exclude are still committed.
- The program makes the commit itself after confirmation and offers a retry when a pre-commit hook rejects it.
How to disable. Remove the program with npm uninstall -g aicommit2 or brew uninstall aicommit2. If a prepare-commit-msg hook was installed, delete it from the repository's .git/hooks folder. Provider keys live in the aicommit2 config and are deleted by hand.
FAQ
How do I install aicommit2 and start using it?
Run brew install aicommit2 or npm install -g aicommit2, then aicommit2 setup to configure providers. In a repository stage changes with git add and run aicommit2: a list of messages appears to choose from.
Can I use my Claude Code subscription?
Yes. The Claude Code (Preview) mode runs the Claude Code CLI installed on your machine with your Pro or Max subscription, and no separate API key is needed. The Copilot SDK and Gemini CLI modes need their own authorized CLIs.
How do I get a message without committing?
Run aicommit2 --dry-run. If the output is piped or redirected, the first message is picked without a prompt and written to stdout, which suits scripts. For LazyGit there is --output json.
Which version control systems are supported?
Git, YADM and Jujutsu. The program detects the system itself, and forcing one uses the --git, --yadm and --jj flags. For Jujutsu the --jj-auto-new flag runs jj new after jj describe.
How do I use aicommit2 as a git hook?
Run it with the --hook-mode flag and it works as a prepare-commit-msg hook. For the pre-commit framework there is the --pre-commit flag. If a hook rejects the commit, aicommit2 --retry repeats the saved message without generating a new one.
Discussion
No questions or reviews yet.
Related
CLI toolsBefore committing, compare several model-written messages and copy the chosen text into the Git interface you already use.
A CLI that writes Conventional Commits messages from the diff and keeps the changelog, using Claude or an OpenAI-compatible API.
gac writes a commit message from the diff with one of 35 providers and gives agents MCP tools for status and commit.
cogit records every message to an agent as a thought commit and ties code to it, so cogit why explains the reason behind any line.
Commit policy as code: validates messages, branches, authors and AI attribution from one cchk.toml in hooks and CI.
A CLI that splits changes into atomic commits and writes conventional commit messages through an LLM, plus a skill for agents.
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Repository stars | Main difference |
|---|---|---|---|
| aicommit2 (this card) | no | 532 | |
| aicommits | no | 9,131 | a similar tool, while aicommit2 queries several providers at once and supports Jujutsu, YADM and code review |
| Conventional Commit Message skill for agents | yes | 8,532 | a skill with message format rules, while aicommit2 generates messages from the diff itself |
README in short
The README opens with a quick start and feature list, then describes the supported providers in a table with default models. How it works, version control systems, command-line flags, LazyGit and git hook integrations, configuration, code review and watch mode follow.