gitmsg suggests a concise Conventional Commit message from your staged Git diff using an OpenAI-compatible API. It can talk to OpenAI or Google AI Studio with the same chat completions flow.
- Reads the staged diff with
git diff --cached - Sends the diff to an OpenAI-compatible chat completions endpoint
- Prints a suggested commit message in
type(scope): descriptionform - Optionally runs
git commit -m "..."
git clone https://github.com/jsicard833/gitmsg.git
cd gitmsg
cargo build --releaseThe binary is built as target/release/gitmsg. You can also install it locally with:
cargo install --path .Set these environment variables before running the tool:
AI_PROVIDER- optional provider selector,openaiorgoogle; defaults to auto-detectOPENAI_API_KEY- required when using OpenAIOPENAI_BASE_URL- optional custom base URL, defaults tohttps://api.openai.com/v1OPENAI_MODEL- optional model name, defaults togpt-5.4-miniGOOGLE_API_KEY- required when using Google AI StudioGOOGLE_BASE_URL- optional custom base URL, defaults tohttps://generativelanguage.googleapis.com/v1beta/openaiGOOGLE_MODEL- optional model name, defaults togemini-3.5-flash
Example:
export OPENAI_API_KEY=your_key_here
export OPENAI_BASE_URL=https://api.openai.com/v1
export OPENAI_MODEL=gpt-5.4-mini
# or
export AI_PROVIDER=google
export GOOGLE_API_KEY=your_google_key_here
export GOOGLE_MODEL=gemini-3.5-flashGenerate a suggested commit message:
git add .
gitmsgGenerate and commit immediately:
gitmsg --commitPrint debug details while running:
gitmsg --verboseInteractive mode with three suggestions and a selection prompt:
gitmsg -iAfter you choose a suggestion, gitmsg will commit it immediately.
You’ll see output like this:
1. feat(vector): add iterator support
2. feat(vector): implement begin/end methods
3. refactor(vector): improve iterator handling
Select [1]:
Press Enter to accept the first suggestion.
feat(parser): add staged diff summarization