Skip to content

takai/git-ai-commit

Repository files navigation

git-ai-commit

Generate Git commit messages from staged diffs using your preferred LLM CLI.

Install

Package managers:

Homebrew:

brew tap takai/tap
brew install git-ai-commit

mise:

mise use -g github:takai/git-ai-commit@latest

Build from source (outputs to bin/):

make build

Put bin/git-ai-commit on your PATH to enable git ai-commit.

Usage

git ai-commit [options]

Common options:

  • --context VALUE Additional context for the commit message
  • --context-file VALUE File containing additional context
  • --prompt VALUE Bundled prompt preset: default, conventional, gitmoji, karma
  • --prompt-file VALUE Path to a custom prompt file
  • --engine VALUE Override engine name
  • --amend Amend the previous commit
  • -a, --all Stage modified and deleted files before generating the message
  • -i, --include VALUE Stage specific files before generating the message
  • --debug-prompt Print the prompt before executing the engine
  • --debug-command Print the engine command before execution
  • -h, --help Show help

Configuration

Configuration is layered, allowing global defaults with per-repository overrides:

  1. User config: ~/.config/git-ai-commit/config.toml
  2. Repo config: .git-ai-commit.toml at the repository root
  3. Command-line flags

This makes it easy to keep personal preferences (engine, style) while enforcing repository-specific commit rules. Repository config is applied only after an initial trust prompt.

Example: Use Codex with Conventional Commits by default

engine = "codex"
prompt = "conventional"

Supported settings:

  • engine Default engine name (string)
  • prompt Bundled prompt preset: default, conventional, gitmoji, karma
  • prompt_file Path to a custom prompt file (relative to the config file)
  • engines.<name>.args Argument list for the engine command (array of strings)

Engines

Supported engines:

  • claude
  • gemini
  • codex

If no engine is configured, auto-detection tries commands in this order: claudegeminicodex. The first available command is used.

Any other engine name is treated as a direct command and executed with the prompt on stdin.

Example: Use ollama with gemma3:4b

engine = "ollama"

[engines.ollama]
args = ["run", "gemma3:4b"]

Prompt presets

Bundled presets live in internal/config/assets/:

Custom Prompts

Example: Use a custom prompt file

engine = "claude"
prompt_file = "prompts/commit.md"

Note: prompt and prompt_file are mutually exclusive within the same config file. If both are set, an error is returned. When settings come from different layers (user config vs repo config), the later layer wins.

Acknowledgements

This tool was inspired by how @negipo used a tool like this in his workflow to make his work much more efficient.

About

Generate Git commit messages from staged diffs using your preferred LLM CLI.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages