AI Commit — Auto-Generate Git Commits with AI
CLI tool that generates conventional commit messages from your staged changes using AI. Supports Claude, GPT-4, and local models. One command for perfect commit messages. 3,000+ stars.
What it is
AI Commit is a CLI tool that generates conventional commit messages from your staged Git changes using AI. You stage your changes with git add, run the AI Commit command, and it analyzes the diff to produce a clear, descriptive commit message following conventional commit format. It supports Claude, GPT-4, and local models.
This tool targets developers who want consistently formatted commit messages without spending time writing them. It reads the actual code diff, understands what changed, and produces messages that describe the why rather than just listing file names.
Why it saves time or tokens
Writing good commit messages takes thought. Most developers default to lazy messages like 'fix bug' or 'update code' because proper messages feel like overhead. AI Commit removes this friction by generating descriptive messages automatically. The tool sends only the staged diff to the AI, keeping token usage proportional to the change size rather than the entire codebase.
How to use
- Install the CLI tool globally:
npm install -g aicommitor via your preferred package manager - Configure your preferred AI provider and API key
- Stage changes and run:
aicommitto generate and apply a commit message
Example
# Stage your changes
git add src/auth/login.ts src/auth/session.ts
# Generate commit message
aicommit
# Output:
# feat(auth): add session refresh on token expiry
#
# - Check token expiration before API calls
# - Refresh session automatically when within 5min of expiry
# - Add retry logic for failed refresh attempts
| Feature | Description |
|---|---|
| Conventional commits | type(scope): description format |
| Multi-model | Claude, GPT-4, Ollama, local models |
| Diff-based | Analyzes actual code changes |
| Interactive | Review and edit before committing |
| Configurable | Custom prompts and templates |
Related on TokRepo
- AI tools for coding — developer productivity tools on TokRepo
- Automation tools — Git workflow automation helpers
Common pitfalls
- Very large diffs exceed model context limits; commit smaller, focused changes for better message quality
- The generated message reflects what the AI infers, not your intent; always review before accepting
- API key configuration varies by tool version; check the documentation for the correct environment variable or config file format
Frequently Asked Questions
AI Commit supports multiple providers including OpenAI (GPT-4, GPT-4o), Anthropic (Claude), and local models through Ollama. You configure the provider and model in a config file or environment variable. Some versions also support Google Gemini and other providers.
Yes. AI Commit generates messages in conventional commit format: type(scope): description. Types include feat, fix, refactor, docs, test, chore, and others. The scope is inferred from the changed file paths. You can customize the prompt to match your team's commit conventions.
Cost depends on the AI provider and diff size. A typical commit with a few hundred lines of diff costs a fraction of a cent with cloud providers. Using local models through Ollama makes it completely free. The tool sends only the staged diff, not your entire codebase.
AI Commit is designed for interactive local development, not CI/CD. In CI, commits are already made. However, you could use it in a pre-commit hook or a squash-merge workflow where the final commit message needs generating. Run it in non-interactive mode for automated contexts.
Most AI Commit tools support custom prompts or templates. You can specify the commit types you use, require certain scopes, or add custom instructions like including ticket numbers. Check your specific tool's configuration for prompt customization options.
Citations (3)
- aicommits GitHub— AI-powered commit message generation from Git diffs
- Conventional Commits— Conventional commits specification for structured messages
- Git Docs— Git diff for analyzing staged changes
Related on TokRepo
Source & Thanks
Discussion
Related Assets
Claude-Flow — Multi-Agent Orchestration for Claude Code
Layers swarm and hive-mind multi-agent orchestration on top of Claude Code with 64 specialized agents, SQLite memory, and parallel execution.
ccusage — Real-Time Token Cost Tracker for Claude Code
CLI that reads ~/.claude logs and breaks down Claude Code token spend by day, session, and project — pluggable into your statusline.
SuperClaude — Workflow Framework for Claude Code
Adds 16+ slash commands, 9 cognitive personas, and a smart flag system to Claude Code in one pipx install.