A tiny Rust CLI that drafts a commit message from your staged changes using
Claude Code (Haiku), then opens
git commit with the message pre-filled so you can review, edit, or abort.
- Parses standard
git commitflags (see Supported flags) to decide what to diff and how to prompt. - Checks you're in a git repo and that there's something to commit.
- For plain and
--amendcommits, runsgit hook run --ignore-missing pre-commitas an early check — if hooks fail, the tool aborts before making any API call. (For-aand pathspec commits the staged index isn't what gets committed, so hooks run at commit time instead.) - Feeds the relevant diff to
claude -p --model haikuover stdin. - Cleans up the response and runs
git commit -e -m "<message>" …, inheriting your terminal so$EDITORopens normally.
Large diffs are truncated at 60KB to keep the prompt sane.
- Rust (stable)
git≥ 2.36 (forgit hook run)claudeCLI, installed and authenticated (tested with Claude Code 2.x; requires a version that supports--output-format jsonand--disable-slash-commands)
Homebrew (macOS and Linux):
brew install getkono/tap/git-aicommitgit-aicommit calls the claude CLI (not in Homebrew) and
git ≥ 2.36 at runtime — see Requirements. brew info getkono/tap/git-aicommit repeats this.
From crates.io (requires Rust):
cargo install git-aicommitPre-built binary — download from the latest release,
extract, and copy to a directory on your $PATH:
# Linux/macOS example
tar xzf git-aicommit-x86_64-unknown-linux-musl.tar.gz
mv git-aicommit ~/.local/bin/Build from source:
cargo build --release
cp target/release/git-aicommit ~/.local/bin/ # or anywhere on $PATHNaming the binary git-aicommit lets you invoke it as a git subcommand.
git add -p
git aicommitYour editor opens with the AI-generated message. Save to commit, or quit with an empty message to abort.
git aicommit aims to be a drop-in for git commit: it understands the common flags and forwards anything else straight through. Pass --model (if you use it) before any git flags; run git aicommit --help for a summary, or git aicommit --version to print the version, build metadata, and binary path.
Shape the diff the AI sees:
git aicommit -a # include all tracked changes (like `git commit -a`)
git aicommit src/foo.rs # commit only these paths (working-tree content, like git's --only)
git aicommit -p # stage hunks interactively first, then summarize what you staged
git aicommit --amend # regenerate the message from the previous message + combined diffSteer the AI:
git aicommit -m "call out the perf fix" # an instruction, NOT a literal message (repeatable)
git aicommit -t .gitmessage # make the output follow a template fileForwarded verbatim to git commit — -e/--edit (on by default), -n/--no-verify, -s/--signoff, -S/--gpg-sign, --author, --date, --allow-empty, --no-edit, and anything else not listed here:
git aicommit --no-verify --signoff--no-verify serves double duty: it skips the pre-commit pre-check (so no API tokens are spent if you intend to bypass hooks) and passes --no-verify to the final git commit.
Preview without committing:
git aicommit --dry-run # print the diff + generated message, then exitBypass the AI entirely — when the message already comes from elsewhere, git handles the commit directly with no API call:
git aicommit --fixup HEAD~2
git aicommit --squash <commit>
git aicommit -C <commit> # also -c / -F / --reuse-message / --reedit-message / --fileUse -- to separate paths from flags when a filename could look like a flag:
git aicommit -- --weird-filename- The prompt asks for Conventional Commits style (
feat:,fix:, etc.), imperative subject ≤72 chars, optional body explaining the why. - By default the editor opens so you can review before committing; quit with an empty message to abort.
--no-editcommits the generated message directly, and--dry-runnever commits. - No API key handling here; auth is delegated entirely to the
claudeCLI.