Skip to content

madstone-tech/git-msg

Repository files navigation

git-msg

AI-assisted git commit message generator with multi-provider LLM support.

CI Go Report Card License: MIT

git-msg watches your staged diff, calls an LLM, and drops a commit message into an interactive TUI where you can confirm, edit, or abort — before anything is committed.

git add .
git-msg generate
  Generated commit message:
  > Use as-is
    Edit inline
    Open $EDITOR
    Abort

feat(config): add XDG-compliant path resolution via internal/dirs

Features

  • Multi-provider — OpenAI, Anthropic (Claude), Google Gemini, Ollama (local)
  • Interactive TUI review — confirm, edit inline, open $EDITOR, or abort
  • Git hook integration — install as prepare-commit-msg for automatic generation on every git commit
  • Customisable prompts — Jinja2-style templates with {{ diff }}, {{ branch }}, {{ log }} variables
  • Secure credentials — API keys stored in the system keychain, never in config files
  • XDG config — all config lives under ~/.config/mdstn/git-msg/

Installation

Homebrew (macOS / Linux)

brew tap madstone-tech/tap
brew install git-msg

Go install

go install github.com/madstone-tech/git-msg@latest

Binary releases

Download the latest binary for your platform from the Releases page, extract, and move to a directory on your PATH:

tar -xzf git-msg_Darwin_arm64.tar.gz
sudo mv git-msg /usr/local/bin/

Quick start

1. Run any git-msg command — the first-run wizard launches automatically when no config file exists:

  git-msg — first-run setup
  ─────────────────────────

  Select LLM provider
  > Anthropic (Claude)
    OpenAI (GPT)
    Google Gemini
    Ollama (local)

For Ollama, git-msg queries ollama list and presents a model picker. For cloud providers, you enter a model name and API key (stored in the keychain).

2. Stage some changes and generate:

git add src/
git-msg generate

3. (Optional) Install the git hook so generation happens automatically on every git commit:

git-msg hook install

See Getting Started for a full walkthrough.


Supported providers

Provider Default model Needs API key
anthropic claude-haiku-4-5 Yes
openai gpt-4o-mini Yes
gemini gemini-1.5-flash Yes
ollama (from ollama list) No

Override the provider for a single run:

git-msg generate --provider ollama

See Providers for setup instructions for each provider.


Configuration

Config file: ~/.config/mdstn/git-msg/config.toml

[provider]
name  = "anthropic"
model = "claude-haiku-4-5"

[ollama]
host = "http://localhost:11434"

[prompt]
default = "conventional"

[hook]
global = false
git-msg config set provider.name ollama
git-msg config set provider.model llama3
git-msg config show

See Configuration for all keys and credential management.


Prompt templates

git-msg ships with a built-in conventional template that follows the Conventional Commits specification. Create your own templates and edit them in $EDITOR:

git-msg prompt list
git-msg prompt show conventional
git-msg prompt edit conventional
git-msg prompt reset conventional

See Prompt Templates for the template format and variable reference.


Documentation

Document Description
Getting Started Installation, first run, and daily workflow
Configuration Config file, all keys, credential storage
Providers Setup guide for each LLM provider
Prompt Templates Template format, variables, and customisation
Git Hook Automatic generation via prepare-commit-msg
CLI Reference Complete command and flag reference

Development

git clone https://github.com/madstone-tech/git-msg
cd git-msg
task build          # compile to bin/git-msg
task test           # run test suite
task ci             # fmt + vet + lint + constitution + test + build

Requirements: Go 1.26+, Task


License

MIT

About

AI-assisted git commit message generator — multi-provider LLM support (OpenAI, Anthropic, Gemini, Ollama), interactive TUI review, and git hook lifecycle management

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors