Automatically generate git commit messages using Claude 3 Haiku. This tool analyzes your staged changes and creates clear, concise commit messages. It uses the Conventional Commit format by default but can adapt to repository-specific or author-specific styles.
- Generates clear, concise commit messages from staged changes
- Supports multiple LLM providers:
- Anthropic Claude (default)
- OpenAI GPT models
- Ollama (local LLMs)
- Supports various commit formats:
- Conventional Commits (default)
- Angular
- Semantic Git Commits (with emojis)
- Linux Kernel style
- GitHub issue-reference style (e.g.,
[#123]: description
) - Custom styles from repository or author history
- Simple CLI interface
Get up and running in minutes:
-
Install the tool:
curl -fsSL https://raw.githubusercontent.com/sidedwards/auto-commit/main/scripts/install.sh | bash
-
Set up your API key (if using Anthropic or OpenAI):
- Anthropic (default): Get your API key
- OpenAI: Get your API key
- Ollama: No API key needed (ensure Ollama is running locally).
-
Generate a commit message:
git add <files> auto-commit
-
Review and confirm:
- Accept, edit, reject, or regenerate the proposed commit message.
curl -fsSL https://raw.githubusercontent.com/sidedwards/auto-commit/main/scripts/install.sh | bash
This script:
- Downloads the correct binary for your system.
- Adds it to your PATH.
- Makes it executable.
-
Download the latest release from GitHub Releases.
-
Move the binary to a PATH directory and make it executable:
- macOS (M1/M2):
sudo mv auto-commit-darwin-arm64 /usr/local/bin/auto-commit sudo chmod +x /usr/local/bin/auto-commit
- macOS (Intel):
sudo mv auto-commit-darwin-x64 /usr/local/bin/auto-commit sudo chmod +x /usr/local/bin/auto-commit
- Linux:
sudo mv auto-commit-linux-x64 /usr/local/bin/auto-commit sudo chmod +x /usr/local/bin/auto-commit
- Windows (PowerShell as Admin):
move auto-commit-windows-x64.exe C:\Windows\System32\auto-commit.exe
- macOS (M1/M2):
- Install Deno:
curl -fsSL https://deno.land/x/install/install.sh | sh
- Clone and install:
git clone https://github.com/sidedwards/auto-commit.git cd auto-commit deno task install
- Quick Install or Manual:
curl -fsSL https://raw.githubusercontent.com/sidedwards/auto-commit/main/scripts/install.sh | bash
- From Source:
cd auto-commit deno task update
- Stage your changes:
git add <files>
- Run the tool:
auto-commit
- Review the commit message and select:
(a)ccept
(e)dit
(r)eject
(n)ew message
-
Add a Git alias:
git config --global alias.ac '!auto-commit'
Then use:
git ac
-
Choose a commit format:
auto-commit --format=conventional # Default auto-commit --format=angular # Angular style auto-commit --format=semantic # With emojis auto-commit --format=kernel # Linux Kernel style auto-commit --format=issue # GitHub issue-reference
-
Learn custom styles:
- From repository history:
auto-commit --learn
- From a specific author:
auto-commit --learn --author="[email protected]"
- From repository history:
-
List repository authors:
auto-commit --list-authors
Choose the LLM provider and model that best suits your needs.
-
Anthropic Claude (default):
claude-3-5-haiku-20241022
(default): Fast and compact.claude-3-5-sonnet-20241022
: Balanced performance.claude-3-7-sonnet-20250219
: Most powerful with reasoning.
-
OpenAI:
gpt-4o-mini
(default): Fast and cost-effective.gpt-4o
: Fast, intelligent, and flexible.o3-mini
: Fast and flexible with reasoning.o1
: High intelligence with reasoning.
-
Ollama (local LLMs):
- Depends on your Ollama setup. Examples:
llama3
(default): Meta's latest model.mistral
: Mistral 7B.mixtral
: Mixtral 8x7B.codellama
: Code-optimized.
- Depends on your Ollama setup. Examples:
- List all models:
auto-commit --list-models
- List models for a provider:
auto-commit --list-models --provider=anthropic
- Use a specific provider/model:
auto-commit --provider=anthropic --model=claude-3-opus-20240229 auto-commit --provider=openai --model=gpt-4o auto-commit --provider=ollama --model=llama3
- Custom Ollama URL:
auto-commit --provider=ollama --base-url=http://localhost:11434
-
API Keys:
-
Commit Formats:
- Default: Conventional Commits.
- Change with
--format
(see Usage).
-
Custom Styles:
- Train with
--learn
or--learn --author="email"
.
- Train with
- Git
- GitHub CLI (gh) - for issue integration
- Vim - for editing commit messages
- API keys (Anthropic/OpenAI) or Ollama running locally
MIT