π AI writes your git commit messages. You ship code.
Stop staring at your terminal wondering what commit message to write. aicommit reads your staged changes, understands your code, and generates the perfect commit message β in any style you want.
- π§ AI-Powered β Uses DeepSeek, OpenAI, Anthropic, Ollama, or any compatible API
- π¨ 4 Commit Styles β Conventional Commits, Gitmoji, Simple, Detailed
- π― Smart Context β Auto-detects scope, branch type, breaking changes, monorepo packages
- π Branch-Aware β Infers commit type from branch name (feat/xxx, fix/xxx)
- π₯ Breaking Change Detection β Flags breaking changes with
! - π¦ Monorepo Support β Detects package from directory structure
- π Multi-Provider β DeepSeek, OpenAI, Anthropic, Ollama, custom endpoints
- π Code Review β AI code review of staged changes
- π PR Description β Generate pull request descriptions from branch diffs
- π¦ Squash Messages β Generate consolidated messages from commits
- π Changelog Generation β Auto-generate changelog entries
- βοΈ Config Management β Set/get config via CLI (
--set,--get) - π« .aicommitignore β Per-project file/diff ignore patterns
- β Conventional Validation β Validate and auto-fix conventional commits
- π AI Retry β Exponential backoff on API failures
- π Provider Override β Switch AI provider at runtime (
--provider) - πΎ Save Output β Save generated messages to file (
--output/-o) - π Enhanced Stats β Per-repo, per-model breakdown with date range
- π Log Filtering β Filter history by repo or style (
--log-repo,--log-style) - π Message Templates β Save/apply named message format templates (
--msg-template) - βοΈ Editor Command β Specify custom editor via
--editor-cmd(e.g.--editor-cmd "code --wait") - π€ Shell Completions β bash, zsh, fish, PowerShell
- πͺ Git Hook β Install as prepare-commit-msg hook
- π Clipboard β Auto-copy with
--copy - π CI/CD Ready β GitHub Action included, AICOMMIT_* env vars
- βοΈ Edit Mode β Edit message in $EDITOR before commit
- β‘ Auto-Stage β
--stageto auto-add files - π₯οΈ Beautiful CLI β Rich output with token stats and progress
pip install aicommitOr with pipx (recommended for CLI tools):
pipx install aicommit# 1. Setup (one-time, 2 steps)
aicommit --init
# 2. Stage + generate + commit in one go
aicommit --stage -y
# Or step-by-step
git add .
aicommitThat's it! The AI analyzes your diff and generates a commit message. Review and confirm, or use -y to skip confirmation.
| Style | Example | Best For |
|---|---|---|
conventional (default) |
feat(auth): add OAuth2 login flow |
Teams, CI/CD, changelogs |
emoji |
β¨ Add OAuth2 login flow |
Personal projects, fun repos |
simple |
Add OAuth2 login flow |
Quick commits |
detailed |
Multi-line with bullet points | Complex changes |
aicommit -s emoji # Use emoji style
aicommit -s detailed # Detailed with bullet points
aicommit -s simple # Short and sweetaicommit doesn't just read your diff β it understands the context:
- Scope Detection:
src/auth/login.ts+src/auth/logout.tsβ scope:auth - Branch Inference: Branch
feat/oauth-loginβ type:feat - Breaking Changes: Detects deprecated APIs, signature changes β adds
!flag - Style Matching: Learns from your last 5 commit messages
- File Context: Understands which files changed and why it matters
$ aicommit
Staged: 3 file(s) β scope: auth β branch suggests: feat β BREAKING CHANGE DETECTED
Repo: aicommit | Branch: feat/oauth-login
ββ Generated Message (π Conventional) βββ
β feat(auth)!: add OAuth2 login flow β
β β
β BREAKING CHANGE: removed legacy token β
β endpoint in favor of OAuth2 β
ββββββββββββββββββββββββββββββββββββββββββ
Model: deepseek-chat | Tokens: 420β68 | Time: 820ms
Commit with this message? [y/N]:# Quick setup (configure git + AI provider)
aicommit --init
# Stage, generate, and commit in one command
aicommit --stage -y
# Basic usage
aicommit # Generate and confirm
# Skip confirmation
aicommit -y
# Preview without committing
aicommit --dry-run
# Provide additional context
aicommit -m "fixing race condition in websocket handler"
# Use a specific style
aicommit -s conventional
# Edit generated message before committing
aicommit -e
# Copy generated message to clipboard
aicommit --copy
# Override token limit
aicommit --max-tokens 1000
# Install as git hook (auto-suggests on every commit)
aicommit --install-hook
# Remove the git hook
aicommit --uninstall-hook
# Reconfigure
aicommit --config# Show full configuration
aicommit --config
# Get a specific value
aicommit --get api.model
# Set a value
aicommit --set api.model=gpt-4
# Reset to defaults
aicommit --reset-configCreate .aicommitignore in your repo root to exclude files from AI analysis:
# .aicommitignore
*.lock
*.log
dist/*
secrets.env
generated/*Patterns use the same glob syntax as .gitignore and are merged with built-in noise filtering.
Save named templates to format commit messages your way:
# Save a template
aicommit --msg-template-save feat_only="{type}: {description}"
aicommit --msg-template-save emoji_header="{emoji} {type}({scope}): {description}"
# List saved templates
aicommit --msg-template-list
# Apply a template
aicommit --msg-template feat_only
# Delete a template
aicommit --msg-template-delete feat_onlyTemplate variables available: {type}, {scope}, {description}, {body}, {emoji}, {breaking}, {branch}.
# Review staged changes before committing
aicommit --review
# Review with severity filter
aicommit --review --severity high
# Focus on specific area
aicommit --review -m "SQL injection risks"# Generate PR description from branch diff
aicommit --pr
# Specify base branch
aicommit --pr --pr-base develop
# Add context
aicommit --pr -m "async refactor, focus on error handling"# Generate squash message from last 5 commits
aicommit --squash 5
# Generate changelog entry
aicommit --changelog
# With version tag
aicommit --changelog --version-tag v1.3.0# Validate conventional format
aicommit --validate
# Auto-fix format if needed
aicommit --auto-fix# Generate for your shell
aicommit --completion bash > ~/.aicommit-completion.bash
aicommit --completion zsh > ~/.aicommit-completion.zsh
aicommit --completion fish > ~/.config/fish/completions/aicommit.fish
aicommit --completion powershellTemporarily switch AI providers without changing your config:
# Use OpenAI instead of your default DeepSeek
aicommit --provider openai
# Use a local model
aicommit --provider ollama
# Anthropic Claude
aicommit --provider anthropicAll config can be overridden via environment variables:
export AICOMMIT_API_KEY="sk-xxx"
export AICOMMIT_MODEL="gpt-4o"
export AICOMMIT_STYLE="conventional"
export AICOMMIT_PROVIDER="openai"
export AICOMMIT_TEMPERATURE="0.3"GitHub Action available β see action.yml:
- uses: Yangge521/aicommit@master
with:
api_key: ${{ secrets.AICOMMIT_API_KEY }}
style: conventional
stage: trueInstall aicommit as a prepare-commit-msg hook and get AI suggestions automatically on every git commit:
aicommit --install-hookNow when you run git commit, the editor will be pre-filled with an AI-generated message. You can edit it or accept it as-is.
git add .
git commit
# β Editor opens with AI suggestion pre-filled!Remove anytime:
aicommit --uninstall-hookaicommit stores config at ~/.aicommit/config.toml:
# API settings
endpoint = "https://api.deepseek.com/v1"
key = "sk-your-api-key"
model = "deepseek-chat"
# Commit preferences
style = "conventional"
language = "auto"
max_diff_lines = 200
auto_confirm = false| Provider | Free Tier | Setup |
|---|---|---|
| DeepSeek | β 500M tokens | Get Key |
| OpenAI | β Pay-as-you-go | Get Key |
| Ollama (local) | β Free | endpoint="http://localhost:11434/v1" |
| Groq | β Free tier | Get Key |
| Any OpenAI-compatible | β | Set endpoint to your API |
# Start Ollama
ollama pull llama3.2
# Configure aicommit
aicommit --config
# β Choose "Custom"
# β Endpoint: http://localhost:11434/v1
# β Model: llama3.2The Problem: Writing good commit messages is tedious. Most developers either write vague messages ("update", "fix") or spend too long crafting the perfect one.
The Solution: Let AI do it. aicommit understands your code changes and generates messages that are:
- Accurate β Based on actual diff analysis, not guessing
- Consistent β Follows your team's conventions automatically
- Context-Aware β Scope detection, branch inference, breaking change awareness
- Fast β Generated in under a second
- Customizable β Your style, your rules, your model
git clone https://github.com/Ghy/aicommit.git
cd aicommit
pip install -e ".[dev]"
pytest- π Message template system: save/apply named message format templates
--msg-template NAMEapply saved template--msg-template-save NAME=FORMATsave a template--msg-template-listlist all saved templates--msg-template-delete NAMEdelete a template- Template variables:
{type},{scope},{description},{body},{emoji},{breaking},{branch}
- βοΈ
--editor-cmdflag to override$EDITOR(e.g.--editor-cmd "code --wait") - 70 tests (15 new)
- π
--providerruntime override (switch AI provider without changing config) - πΎ
--output/-osave generated messages to file - π
--statsnow shows per-repo and per-model breakdown - π
--log-repo/--log-stylefilter history entries
- βοΈ
--set/--getconfig management from CLI - π«
.aicommitignoreper-project file/diff ignore patterns - π Fixed deepcopy config pollution, HIDDEN name error, --config dedup, --diff routing
- π AI retry with exponential backoff
- πͺ Git hook auto-install (prepare-commit-msg)
- π¦ Monorepo package detection
- π₯ Breaking change-aware (auto
!prefix) - π§Ό
--reset-configconfirmation prompt - π
--statsusage statistics - π―
--scope/--template/--copyflags
- π
--reviewAI code review - π
--prPR description generator - π¦
--squashsquash commit message - π
--changelogchangelog generator - πΎ
--copyclipboard support
- π¨ 4 commit styles: conventional, emoji, simple, detailed
- π·οΈ Auto scope detection from file paths
- βοΈ
.aicommit.tomlconfig support
- π Initial release with DeepSeek API support
MIT Β© Ghy
Built with β€οΈ for developers who'd rather write code than commit messages