Nutlope/aicommits
A CLI that writes your git commit messages for you with AI
aicommits — AI-generated git commit messages
What it is: A command-line tool that writes your git commit messages for you using AI. You stage your changes, run aicommits, and it analyzes the staged diff and proposes a commit message.
Why it exists: Writing commit messages is tedious. This tool automates it, and in v5 it can use AI subscriptions you already pay for (Claude, ChatGPT via Codex, OpenCode Go) instead of requiring a separate API key.
Core workflow
- Install:
npm install -g aicommits(requires Node.js v22 or newer) - Set up: Run
aicommits setupto choose your AI provider. It detects subscriptions already logged in on your machine (Claude CLI, Codex CLI, OpenCode Go key) and lists them first. For providers that need one, it walks you through getting an API key. - Use:
git add <files>then runaicommits. It generates a message, shows it to you, and commits when you confirm.
Key features
- Use subscriptions you already have: If you're logged into Claude Code or Codex, or have an OpenCode Go plan, no API key is needed. aicommits runs your installed CLI (Claude or Codex) through its SDK — read-only, no tools, no shell access, no saved sessions. It never reads or copies your credentials; login always happens in the vendor's own CLI.
- Many providers: Together AI (recommended default), Claude Agent, Codex, OpenCode Go, OpenAI, Anthropic, Groq, xAI, OpenRouter, Ollama (local), LM Studio (local), or any custom OpenAI-compatible endpoint.
- Multiple commit message formats:
plain(default),conventional(Conventional Commits),conventional+body,gitmoji(emoji-based), orsubject+body. - Generate multiple options:
--generate <n>produces several messages to pick from (costs more tokens). - Custom prompts:
--promptlets you steer the AI, e.g., "Write commit messages in Italian" or "Focus on performance implications." - Git hook integration:
aicommits hook installadds aprepare-commit-msghook sogit commitautomatically generates a message you can edit before committing. Uninstall withaicommits hook uninstall. - CI/CD support: Set config via commands like
aicommits config set OPENAI_API_KEY="..."instead of interactive setup. - Clipboard mode:
--clipboardcopies the message instead of committing.
Configuration
- View:
aicommits configshows non-default settings (API keys masked). - Get/set:
aicommits config get <key>andaicommits config set <key>=<value>(multiple keys at once allowed). - Change model:
aicommits modelinteractively fetches available models from your provider and lets you pick one. - Update:
aicommits updateauto-detects your package manager (npm, pnpm, yarn, bun) and updates.
Notable config options:
| Key | Default | Purpose |
|---|---|---|
provider |
set during setup | Which AI provider to use |
subscription-detection |
on |
Whether setup looks for Claude/Codex/OpenCode Go logins (only in interactive terminals, never in Git hooks or CI) |
locale |
en |
Language for generated messages (ISO 639-1 codes) |
generate |
1 |
Number of messages to generate |
timeout |
10000 ms (hosted), 60000 ms (Together AI/local) |
Network request timeout |
max-length |
72 |
Preferred character length of the commit subject |
max-output-tokens |
unset | Cap on tokens the model may generate; raise it (e.g., 4096) if a reasoning model burns its budget on thinking and never outputs a message |
thinking |
enabled |
Set to disabled for faster/cheaper responses on compatible providers (not official OpenAI or Together AI) |
type |
plain |
Commit message format |
claude-path / codex-path |
— | Path to the CLI if it's not on your PATH |
Precedence: command-line arguments > environment variables > config file > defaults.
How it works under the hood
The model receives the list of staged files, requests the staged diffs it needs, and returns a validated commit subject (plus optional description). It can only read Git's staged snapshot — unstaged edits are never sent to the AI.
Maintainers
Hassan El Mghari (@Nutlope), Riccardo Giorato (@riccardogiorato), Hiroki Osame (@privatenumber).
Contributing
See the CONTRIBUTING.md guide for setup and testing instructions; bugs and feature requests live in the GitHub Issues.
Related
- Project
- Project
- Project
- Project
- Project