A command-line tool to generate Git commit messages using AI.
- Generate Git commit messages in natural English
- Add a footer to the generated commit messages
- Add a prefix or suffix to the summary line
- Select from a choice of LLM models
- Compare messages generated from all configured models
- Disable or auto-approve various stages
- Option to output just the commit message for use in scripts
- Configuration using standard API provider environment variables
- Uses the Vercel AI SDK (version 5)
- Uses structured JSON with compatible models
- Substantially written using AI coding (Claude Code, Roo Code, and Amp)
npm install -g @johnowennixon/diffdash
Currently, for this application, the best LLM model is gpt-4.1-mini from OpenAI. It is set as the default model. I can only presume they have done a ton of training on diffs.
I am now testing the GPT-5 models and gpt-5-mini-minimal (GPT-5 Mini with reasoning disabled) is behaving much the same. It will probably become the default model soon.
DiffDash requires at least one API key for an LLM provider. These must be provided as environment variables.
# For OpenAI (strongly recommended)
export OPENAI_API_KEY=your-api-key
# For Anthropic
export ANTHROPIC_API_KEY=your-api-key
# For DeepSeek
export DEEPSEEK_API_KEY=your-api-key
# For Google Gemini
export GEMINI_API_KEY=your-api-key
# For OpenRouter (all other models)
export OPENROUTER_API_KEY=your-api-key
# Basic usage (uses defaults)
diffdash
# Automatically stage all changes, but still prompt for commit and push
diffdash --auto-add
# Automatically stage and commit changes, but still prompt for push
diffdash --auto-add --auto-commit
# Fully automated workflow (stage, commit, and push without prompts)
diffdash --auto-add --auto-commit --auto-push
# Generate message for already staged changes only (won't stage any new changes)
diffdash --disable-add
# Skip displaying the status of staged files before commit
diffdash --disable-status
# Don't display the generated commit message
diffdash --disable-preview
# Generate message but don't commit (exit after displaying the message)
diffdash --disable-commit
# Generate message and commit, but don't push or prompt to push
diffdash --disable-push
# Skip git hooks when pushing
diffdash --no-verify
# Add a prefix to the commit message summary line
diffdash --add-prefix "[FIX]"
# Add a suffix to the commit message summary line
diffdash --add-suffix "(closes #123)"
# Display commit messages generated by all models
diffdash --llm-compare
# Specify the LLM model by name
diffdash --llm-model claude-3.5-haiku
# Just output the commit message for use in scripts
diffdash --just-output
# Debug prompts
diffdash --debug-llm-prompts
All command-line arguments are optional.
Argument | Description |
---|---|
--help |
show a help message and exit |
--version |
show program version information and exit |
--auto-add |
automatically stage all changes without confirmation |
--auto-commit |
automatically commit changes without confirmation |
--auto-push |
automatically push changes after commit without confirmation |
--disable-add |
disable adding unstaged changes - exit if no changes staged |
--disable-status |
disable listing the staged files before generating a message |
--disable-preview |
disable previewing the generated message |
--disable-commit |
disable committing changes - exit after generating the message |
--disable-push |
disable pushing changes - exit after making the commit |
--push-no-verify |
bypass git hooks when pushing to Git |
--push-force |
apply force when pushing to Git |
--add-prefix PREFIX |
add a prefix to the commit message summary line |
--add-suffix SUFFIX |
add a suffix to the commit message summary line |
--llm-list |
display a list of available Large Language Models and exit |
--llm-compare |
compare the generated messages from all models - but do not commit |
--llm-model MODEL |
choose the LLM model by name (the default is normally best) |
--llm-excludes MODELS |
models to exclude from comparison (comma separated) |
--just-output |
just output the commit message for use in scripts |
--silent |
suppress all normal output - errors and aborts still display |
--debug-llm-prompts |
show prompts sent to the LLM |
--debug-llm-inputs |
show inputs object sent to the LLM |
--debug-llm-outputs |
show outputs object received from the LLM |
Files containing secrets should not be in Git. But if they are, you can add an entry to a .gitattributes
file with value -diff
to prevent them being viewable by a Git diff. This will prevent DiffDash from sending any contents to the LLM. For example:
# This is file .gitattributes
.env -diff
To install on your laptop:
# Clone the repository
git clone https://github.com/johnowennixon/diffdash.git
cd diffdash
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Make binaries executable
npm link
To rebuild after editing:
# Lint the code
pnpm run lint
# Fix formatting issues (if required)
pnpm run fix
# Build the project
pnpm run build
0BSD