A CLI tool that generates git commit messages using AI.
Analyzes your staged git diff, calls an AI model to suggest a Conventional Commits message, then lets you accept, edit, regenerate, or abort — all from the terminal. Supports Claude (API key or Claude Code Pro/Max subscription), ChatGPT, Ollama, LM Studio, Gemini, and any OpenAI-compatible endpoint.
$ autogit init
Select a provider:
1) Claude (Anthropic API key)
2) Claude Code (Pro/Max subscription — no API key needed)
3) OpenAI-compatible (ChatGPT, Ollama, LM Studio, Gemini, etc.)
> 1
Model name [claude-opus-4-6]:
>
Config saved to ~/.autogit.yaml
$ git add .
$ autogit
[autogit] Analyzing changes...
[autogit] Generating commit message...
Generated message:
─────────────────────────────────────────
feat: add user authentication with JWT tokens
- Implement login/logout endpoints
- Add JWT middleware for protected routes
- Store refresh tokens in Redis
─────────────────────────────────────────
[a] Accept [A] Accept and Push [e] Edit in $EDITOR [r] Regenerate [q] Quit
>
With --all to interactively select which files to stage:
$ autogit --all
Select files to stage (3/4 selected):
[x] M internal/ui/prompt.go
[x] A internal/git/status.go
> [ ] ? temp.log
[x] M main.go
↑/↓ navigate space toggle a all n none enter confirm q quit
[autogit] Staged 3 file(s):
• internal/ui/prompt.go
• internal/git/status.go
• main.go
[autogit] Analyzing changes...
[autogit] Generating commit message...
Files to commit (3):
internal/ui/prompt.go
internal/git/status.go
main.go
Generated message:
─────────────────────────────────────────
feat: add file selector and status parsing
─────────────────────────────────────────
[a] Accept [A] Accept and Push [e] Edit in $EDITOR [r] Regenerate [q] Quit
>
If you run autogit without --all and nothing is staged, the file selector is shown automatically.
With --push to automatically push after committing:
$ git add .
$ autogit --push
[autogit] Analyzing changes...
[autogit] Generating commit message...
...
[autogit] Committed successfully!
[autogit] Pushing...
[autogit] Pushed successfully!
- Go 1.22+
- An API key for your chosen provider (not needed for local models or Claude Code)
1. Install autogit
go install github.com/warunacds/autogit@latestOr build from source:
git clone https://github.com/warunacds/autogit
cd autogit
go build -o autogit .
sudo mv autogit /usr/local/bin/autogit2. Run the setup wizard
autogit initThis creates ~/.autogit.yaml with your provider, model, and endpoint settings.
3. Set your API key
Add the appropriate key to your ~/.zshrc or ~/.bashrc:
# For Claude (API key)
export ANTHROPIC_API_KEY=sk-ant-...
# For ChatGPT / OpenAI
export OPENAI_API_KEY=sk-...Then reload: source ~/.zshrc
For Claude Code (Pro/Max subscription) and local models (Ollama, LM Studio), no API key is needed.
4. Verify it works
autogit --helpIf you installed with go install:
go install github.com/warunacds/autogit@latestIf you built from source:
cd autogit
git pull
go build -o autogit .
sudo mv autogit /usr/local/bin/autogit# Stage your changes
git add .
# Generate and commit
autogit
# Select files to stage interactively
autogit --all
# Commit and push in one step
autogit --push
autogit -p # shorthand
# Override provider or model for one run
autogit --provider openai --model gpt-4o-mini
autogit --provider claudecode| Key | Action |
|---|---|
a |
Accept the message and commit |
A |
Accept the message, commit, and push |
e |
Open $EDITOR to edit the message |
r |
Regenerate — call the AI again for a new suggestion |
q |
Quit without committing |
| (type anything) | Replace the message inline and loop back |
autogit init # select 1) Claude
export ANTHROPIC_API_KEY=sk-ant-...Config (~/.autogit.yaml):
provider: claude
claude:
model: claude-opus-4-6Uses the claude CLI — no API key needed. Requires a Claude Code Pro or Max subscription.
autogit init # select 2) Claude Code
# Make sure `claude` is installed and you're logged inConfig (~/.autogit.yaml):
provider: claudecode
claudecode:
model: "" # leave empty for CLI default, or set a specific modelautogit init # select 3) OpenAI-compatible
# Use default base URL: https://api.openai.com/v1
export OPENAI_API_KEY=sk-...Config:
provider: openai
openai:
base_url: https://api.openai.com/v1
model: gpt-4oautogit init # select 3) OpenAI-compatible
# Set base URL to: http://localhost:11434/v1
# No API key neededConfig:
provider: openai
openai:
base_url: http://localhost:11434/v1
model: llama3autogit init # select 3) OpenAI-compatible
# Set base URL to: http://localhost:1234/v1
# No API key neededConfig:
provider: openai
openai:
base_url: http://localhost:1234/v1
model: local-modelautogit init # select 3) OpenAI-compatible
# Set base URL to: https://generativelanguage.googleapis.com/v1beta/openai
export OPENAI_API_KEY=your-gemini-api-keyConfig:
provider: openai
openai:
base_url: https://generativelanguage.googleapis.com/v1beta/openai
model: gemini-2.0-flash- Loads provider config from
~/.autogit.yaml(with CLI flag overrides) - With
--all(or when nothing is staged), shows an interactive file selector to choose which files to stage - Reads your staged git diff (
git diff --cached) - Sends the diff to the configured AI provider with a Conventional Commits prompt
- Shows the generated message with an interactive menu
- Commits via
git commit -musing your existing git config (name/email) - Optionally pushes to the remote with
--push/-por interactively withA
Diffs larger than 100 KB are automatically truncated before sending to the API.
| Setting | How to set |
|---|---|
| Provider | autogit init or --provider flag |
| Model | autogit init or --model flag |
| Claude API key | ANTHROPIC_API_KEY environment variable |
| Claude Code | claude CLI installed and logged in (Pro/Max subscription) |
| OpenAI API key | OPENAI_API_KEY environment variable (not needed for local models) |
| Editor | EDITOR environment variable (falls back to nano) |
| Diff scope | --all flag (default: staged only) |
| Push after commit | --push / -p flag (default: off) |
MIT