Generate Git commit messages from staged changes using a local Ollama model.
- Reads staged changes and asks Ollama for a commit message
- Prompts for confirmation before running
git commit - Auto-selects an installed chat model when none is configured
- Configurable commit message format and Ollama model
- Skips common build artifacts, lockfiles, and binary files by default
- Summarizes very large diffs when the prompt would exceed 8,000 characters
- Detects bootstrap commits (many new files) and adjusts the prompt
You need Git and Ollama. You do not need Rust or Cargo.
On macOS or Linux, open a terminal and run:
curl -fsSL https://raw.githubusercontent.com/usamakhangt4/git-auto-commit/main/install.sh | shOn Windows, open PowerShell and run:
irm https://raw.githubusercontent.com/usamakhangt4/git-auto-commit/main/install.ps1 | iexStart Ollama and download a model:
ollama pull llama3.2:3bgit add .
git-auto-commitThe tool generates a commit message and asks for confirmation before committing.
Download the archive for your operating system from
GitHub Releases, extract
it, and place the binary in a directory on your PATH.
To choose another installation directory, set GIT_AUTO_COMMIT_INSTALL_DIR
before running one of the quick-install commands above.
This option requires Rust 1.75 or newer.
git clone https://github.com/usamakhangt4/git-auto-commit.git
cd git-auto-commit
cargo build --releaseCopy the binary to a directory on your PATH:
cp target/release/git-auto-commit ~/.local/bin/Ensure ~/.local/bin is on your PATH.
If you already have Rust installed:
cargo install --path .Stage changes, then run the tool inside a Git repository:
git add .
git-auto-commitExample session:
Using model: llama3.2:3b | Format: type(scope): description
Generated Message:
>>> feat(cli): add commit message generator
Commit? [y/N]: y
Successfully committed!
Answer y or Y to commit; anything else aborts.
git-auto-commit set-model llama3.2:3b
git-auto-commit set-format "type(scope): description"
git-auto-commit --help
git-auto-commit --versionset-model and set-format work outside a Git repository.
Config files live in ~/.config/git-auto-commit/ (or the platform equivalent):
| File | Purpose |
|---|---|
model.txt |
Ollama model name (e.g. llama3.2:3b). Empty or missing → auto-discovery |
format.txt |
Commit message format instruction for the model |
ignore.txt |
Path patterns to exclude from the prompt (one per line; # comments allowed) |
Precedence for format: format.txt → COMMIT_FORMAT env var → default type(scope): description.
Default ignore patterns include target/, node_modules/, lockfiles, minified assets, and common binary extensions. If ignore.txt is missing or empty, those defaults apply.
| Variable | Default | Description |
|---|---|---|
OLLAMA_HOST |
http://localhost:11434 |
Ollama API base URL |
COMMIT_FORMAT |
type(scope): description |
Format when format.txt is absent |
GIT_AUTO_COMMIT_TIMEOUT_SECS |
300 |
HTTP timeout for Ollama requests (seconds) |
GIT_AUTO_COMMIT_CONFIG_DIR |
(platform config dir) | Override config directory |
cargo test
cargo clippy --all-targets --all-features -- -D warnings
cargo build --releaseMIT — see LICENSE.