Complete reference for all git-msg commands and flags.
These flags are available on every command:
| Flag | Description |
|---|---|
-h, --help |
Show help for the command |
-v, --version |
Print the version string and exit |
Generate a commit message from the current staged diff.
git-msg generate [flags]| Flag | Type | Description |
|---|---|---|
--dry-run |
bool | Print the generated message to stdout without committing or showing the review TUI |
--provider NAME |
string | Override the configured provider for this run only (anthropic, openai, gemini, ollama) |
--template NAME |
string | Override the configured default template for this run only |
- Loads config from
~/.config/mdstn/git-msg/config.toml - Collects
git diff --cached, current branch, and last 5 commits - Renders the prompt template with the collected context
- Calls the configured LLM provider
- Shows the review TUI (unless
--dry-run) - On confirm: runs
git commit -m <message>
# Standard generation with review
git-msg generate
# Preview without committing
git-msg generate --dry-run
# Use Ollama for this commit only
git-msg generate --provider ollama
# Use a custom template for this commit only
git-msg generate --template jira| Code | Meaning |
|---|---|
0 |
Success, or user aborted (no commit was made) |
1 |
Error (no staged changes, provider failure, config missing) |
Manage git-msg configuration.
Set a configuration value.
git-msg config set KEY VALUESupported keys:
| Key | Example value |
|---|---|
provider.name |
ollama |
provider.model |
fast-coder:latest |
ollama.host |
http://localhost:11434 |
prompt.default |
conventional |
hook.global |
true |
git-msg config set provider.name anthropic
git-msg config set provider.model claude-sonnet-4-5Print the current value of a config key.
git-msg config get provider.name
# anthropicPrint the full resolved configuration as TOML.
git-msg config show[provider]
name = 'anthropic'
model = 'claude-haiku-4-5'
[ollama]
host = 'http://localhost:11434'
[prompt]
default = 'conventional'
[hook]
global = falseAPI keys are never included in this output.
Manage prompt templates.
List all available templates and their source.
git-msg prompt list conventional [embedded]
jira [user]
[embedded]— built-in template shipped withgit-msg[user]— user-defined template in~/.config/mdstn/git-msg/prompts/
Print the full content of a template.
git-msg prompt show conventionalOpen a template in $EDITOR for editing. If no user override exists, the
embedded default is pre-loaded.
git-msg prompt edit conventionalRequires $EDITOR to be set. On save, the result is written to
~/.config/mdstn/git-msg/prompts/<name>.toml.
Delete the user override for a template, restoring the embedded default. Exits 0 if no override exists.
git-msg prompt reset conventionalManage the prepare-commit-msg git hook lifecycle.
Install the hook into the current repository's .git/hooks/ directory.
git-msg hook install [--global]| Flag | Description |
|---|---|
--global |
Install into the directory specified by git config core.hooksPath instead |
The installed script exits silently when no TTY is available, so it does not block non-interactive flows.
Remove the prepare-commit-msg hook.
git-msg hook uninstall [--global]| Flag | Description |
|---|---|
--global |
Remove from the global hooks path |
Exits 0 if the hook file does not exist.
Generate shell completion scripts.
# bash
git-msg completion bash > /etc/bash_completion.d/git-msg
# zsh
git-msg completion zsh > "${fpath[1]}/_git-msg"
# fish
git-msg completion fish > ~/.config/fish/completions/git-msg.fish| Variable | Description |
|---|---|
XDG_CONFIG_HOME |
Override the base config directory (default: ~/.config) |
EDITOR |
Editor used by prompt edit and the "Open $EDITOR" review option |
GIT_MSG_ANTHROPIC_API_KEY |
Anthropic API key (fallback if not in keychain) |
GIT_MSG_OPENAI_API_KEY |
OpenAI API key (fallback if not in keychain) |
GIT_MSG_GEMINI_API_KEY |
Google Gemini API key (fallback if not in keychain) |