AI-powered Git commit assistant that summarizes staged changes using GPT.
Save time, stay in flow, and write better commit messages — automatically.
- Uses GPT to summarize your staged diffs into clear commit messages
- Supports Conventional Commits
- Tone customization (
neutral
,casual
,formal
,funny
, etc.) - Git hook integration via
prepare-commit-msg
- Supports environment variables for default
TYPE
andTONE
- Optional auto mode to skip confirmation (for non-interactive use)
git clone https://github.com/nelson-zack/commit-companion.git
cd commit-companion
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
OPENAI_API_KEY=sk-...
pip install --editable .
commit-companion suggest --tone casual --type feat
Will output something like:
feat: add basic functionality to README.md
Example usage:
git add <file>
commit-companion suggest --tone casual --type feat
git commit -m "your message here"
git push
Install the Git hook with:
commit-companion install-hook
This creates a .git/hooks/prepare-commit-msg script that auto-generates commit messages using GPT. By default, it uses --tone neutral and --type feat.
git add <file> # Stage your changes
git commit # Commit Companion will auto-suggest the message
git push # Push to remote
Override tone or type like this:
TYPE=fix git commit
TONE=funny git commit
TYPE=fix TONE=funny git commit
Uninstall the hook:
commit-companion uninstall-hook
To use commit-companion from any repo without activating a virtual environment:
pip install .
export OPENAI_API_KEY="sk-..."
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.12/bin"
source ~/.zshrc # or ~/.bashrc
commit-companion install-hook
- Config file support (.commitcompanion.json)
- VS Code extension
- Web version / hosted API
- PyPI distribution (pip install commit-companion)
Writing commit messages breaks flow. Commit Companion helps you:
- Stay focused on your code
- Standardize commits with no effort
- Impress your teammates with clear, consistent commit messages
MIT License.