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
TYPEandTONE - Optional auto mode to skip confirmation (for non-interactive use)
pip install commit-companionTo use the CLI globally from any directory, install with --user or inside a virtual environment.
Or, to install from source:
git clone https://github.com/nelson-zack/commit-companion.git
cd commit-companion
pip install .Commit Companion requires access to the OpenAI API. You can provide your key in one of two ways:
OPENAI_API_KEY=sk-...Add to your shell config (~/.zshrc, ~/.bashrc, etc):
export OPENAI_API_KEY="sk-..."Then run:
source ~/.zshrc # or ~/.bashrc- Python 3.8 or later
- An OpenAI API key (required for GPT functionality)
To see all available commands and flags:
commit-companion --helpcommit-companion suggestInstall the Git hook with:
commit-companion install-hookThis 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 remoteOverride tone or type like this:
TYPE=fix git commit
TONE=funny git commit
TYPE=fix TONE=funny git commitUninstall the hook:
commit-companion uninstall-hook- Config file support (.commitcompanion.json)
- VS Code extension
- Web version / hosted API
- ✅ PyPI distribution (available via
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.
Contributions, suggestions, and issue reports are welcome! To get started:
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/my-feature) - Open a pull request