This guide walks you from zero to a working git-msg setup in under five
minutes.
- macOS or Linux
- Git
- One of:
- An API key for Anthropic, OpenAI, or Google Gemini
- Ollama running locally with at least one model pulled
brew tap madstone-tech/tap
brew install git-msggo install github.com/madstone-tech/git-msg@latestDownload the binary for your platform from
GitHub Releases,
extract, and move to your PATH:
# macOS (Apple Silicon)
tar -xzf git-msg_Darwin_arm64.tar.gz
sudo mv git-msg /usr/local/bin/
# macOS (Intel)
tar -xzf git-msg_Darwin_x86_64.tar.gz
sudo mv git-msg /usr/local/bin/
# Linux (x86_64)
tar -xzf git-msg_Linux_x86_64.tar.gz
sudo mv git-msg /usr/local/bin/Verify:
git-msg --versionThe first time you run any git-msg command, the setup wizard launches
automatically if no config file exists.
git-msg generate --dry-run git-msg — first-run setup
─────────────────────────
Select LLM provider
> Anthropic (Claude)
OpenAI (GPT)
Google Gemini
Ollama (local)
Use arrow keys to move, Enter to select.
For Ollama: git-msg runs ollama list and shows all locally available
models. Select the one you want.
For cloud providers: a text input appears pre-filled with a sensible default. Press Enter to accept or type a different model name.
| Provider | Default |
|---|---|
anthropic |
claude-haiku-4-5 |
openai |
gpt-4o-mini |
gemini |
gemini-1.5-flash |
Enter your API key. It is stored in the system keychain — never written to disk. This step is skipped entirely for Ollama.
Config saved. Provider: anthropic Model: claude-haiku-4-5
Your config file is now at ~/.config/mdstn/git-msg/config.toml.
# Stage your changes as normal
git add src/auth.go
# Generate a message
git-msg generateThe tool collects your staged diff, current branch name, and five most recent commits, then sends them to the LLM. A spinner shows progress.
When the message is ready, the review TUI appears:
Generated commit message:
> Use as-is
Edit inline
Open $EDITOR
Abort
feat(auth): add JWT refresh token rotation
| Option | What happens |
|---|---|
| Use as-is | Commits with the generated message |
| Edit inline | Opens a textarea in the terminal to edit the message |
| Open $EDITOR | Opens $EDITOR (e.g. vim, nvim) with the message in a temp file |
| Abort | Exits with code 0; your staged changes are untouched |
Print the generated message without committing or showing the review TUI:
git-msg generate --dry-runUseful for previewing output or piping into other tools.
git-msg generate --provider ollama
git-msg generate --provider openaiThe override applies only to the current invocation; your saved config is unchanged.
git-msg generate --template conventionalInstall git-msg as a prepare-commit-msg hook so it fires automatically
on every git commit:
git-msg hook installFrom that point on:
git add .
git commit # review TUI appears automaticallyTo remove the hook:
git-msg hook uninstallSee Git Hook for global hook installation and hook behaviour details.
| Path | Purpose |
|---|---|
~/.config/mdstn/git-msg/config.toml |
Provider, model, defaults |
~/.config/mdstn/git-msg/prompts/ |
User prompt template overrides |
System keychain (service git-msg) |
API keys |
The XDG_CONFIG_HOME environment variable is respected if set.
- Configuration — all config keys, credential management
- Providers — detailed setup for each LLM provider
- Prompt Templates — customise what gets sent to the LLM
- Git Hook — automate generation on every commit
- CLI Reference — full command and flag reference