Git Commit Analyzer is a Rust-based Git plugin that generates Git Flow–style commit messages from your staged diff using a local llama.cpp model. The CLI summarises large diffs, validates model output, and falls back to deterministic messages when needed.
- Local inference: Uses
llama_cpp_sys_2to run GGUF models without any remote API calls. - Smart diff summarisation: Large lockfiles and generated assets are reduced to concise summaries before prompting.
- Git Flow enforcement: Ensures responses match
<type>(<scope>): <subject>and retries/falls back when they don't. - Interactive CLI: Review, edit, or cancel the generated commit message.
- Multi-language prompts: English (default) and Simplified Chinese.
- Multi-platform support: Pre-built binaries for macOS (Intel & Apple Silicon).
- Git 2.30+
- A local GGUF model (the CLI can download the default
unsloth/gemma-3-270m-it-GGUF)
macOS users can install via Homebrew with pre-built binaries (no Rust compilation required):
brew tap zh30/tap
brew install git-caThis installs a pre-built binary for your platform:
- macOS: Apple Silicon (M1/M2/M3/M4) and Intel (x86_64)
No Rust toolchain or compilation needed! The binary is automatically downloaded from GitHub Releases.
Note: Linux builds are temporarily disabled due to compilation issues. Windows builds are available via GitHub Releases but not distributed via Homebrew.
Download the appropriate binary for your platform from Releases:
# macOS (Apple Silicon)
curl -L -o git-ca.tar.gz https://github.com/zh30/git-commit-analyzer/releases/download/v1.1.2/git-ca-1.1.2-apple-darwin-arm64.tar.gz
tar -xzf git-ca.tar.gz
sudo mv git-ca /usr/local/bin/
chmod +x /usr/local/bin/git-caNote: Linux builds are temporarily disabled. Windows builds are available via GitHub Releases.
If you prefer to build from source:
git clone https://github.com/zh30/git-commit-analyzer.git
cd git-commit-analyzer
cargo build --release
sudo cp target/release/git-ca /usr/local/bin/bash -c "$(curl -fsSL https://sh.zhanghe.dev/install-git-ca.sh)"On first run the CLI will:
-
Scan for models in common directories:
./models(project directory)~/.cache/git-ca/models(Linux/macOS)~/.local/share/git-ca/models(Linux alt)~/Library/Application Support/git-ca/models(macOS)
-
Download default model automatically if none found:
- Downloads
unsloth/gemma-3-270m-it-GGUFfrom Hugging Face - Stores it in
~/.cache/git-ca/models/
- Downloads
-
Prompt for confirmation if multiple models are found:
git ca model # Interactive model selector
git add <files>
git caFor each invocation:
- The staged diff is summarised (lockfiles and large assets are listed but not inlined).
- The llama.cpp model generates a commit message.
- Invalid output triggers a stricter retry; if still invalid, a deterministic fallback is offered.
- Choose to use, edit, or cancel the message.
git ca model— Interactive model selectorgit ca language— Choose English or Simplified Chinese promptsgit ca doctor— Test model loading and inferencegit ca --version— Display version information
cargo fmt
cargo clippy -- -D warnings
cargo test
cargo run -- git ca # try against staged changesKey modules:
src/main.rs— CLI orchestration, diff summariser, fallback generator.src/llama.rs— llama.cpp session management.
Fully automated release via GitHub Actions:
- Push a version tag:
git tag v1.1.2 && git push origin v1.1.2 - GitHub Actions automatically:
- Builds binaries for macOS (Intel & Apple Silicon)
- Creates GitHub Release with changelog
- Generates SHA256 checksums
- Automatically updates Homebrew formula with bottle checksums
- Pushes updates to
homebrew-taprepository
- Users can immediately install with:
brew install git-ca
Note: Linux builds are temporarily disabled due to compilation issues. Windows builds are available via GitHub Releases but not distributed via Homebrew.
See DEPLOY.md for complete release documentation.
- macOS: ✅ Apple Silicon (arm64) and Intel (x86_64) - Pre-built binaries via Homebrew
- Linux: ❌ Temporarily disabled (compilation issues)
- Windows:
⚠️ Available via GitHub Releases (not Homebrew)
Pull requests are welcome. Please include:
cargo fmt/cargo clippy -- -D warnings/cargo testoutputs,- Updates to documentation (
README*.md,AGENTS.md,DEPLOY.md) when behaviour changes, - A short description of manual
git caverification if applicable.
Released under the MIT License. See LICENSE for details.
- The Rust community for providing excellent libraries and tools
- llama.cpp team for the efficient local inference engine