Stop wasting time writing commit messages. Let AI do it for you.
gcommit is an AI-powered CLI tool that analyzes your staged changes and generates perfect commit messages in seconds. No more staring at a blank screen wondering how to describe your changes.
- ⚡ Instant commit messages - Generate professional commits in seconds
- 🎯 Conventional Commits ready - Perfect for teams following standards
- 🌍 Any language - Write commits in English, Russian, Spanish, Chinese, or any language you want
- 🎨 Customizable - Simple, conventional, or your own custom format
- 🔧 Works with any Git workflow - Local, GitHub, GitLab, Bitbucket, you name it
- 🤖 Smart context aware - Analyzes your actual code changes, not just file names
- 💰 Cheap to run - Uses efficient models like
gpt-4o-mini(pennies per month) - 🩺 Built-in diagnostics -
gcommit doctorchecks your setup - 🐚 Shell completion - Tab-completion for bash, zsh, fish
# Install
brew tap opsdevil/tap
brew install opsdevil/tap/gcommit
# Set your OpenAI API key
export OPENAI_API_KEY='sk-your-key-here'
# Stage your changes
git add .
# Let AI write your commit!
gcommitThat's it! You'll see a proposed commit message. Type y to commit, e to edit, or n to cancel.
- Stage your changes with
git add - Run
gcommit - Review the AI-generated message
- Commit with one keypress
$ git add src/auth.py
$ gcommit
Analyzing changes...
Proposed commit message:
feat: add JWT authentication middleware
Implement JWT token validation for protected routes.
Add support for token refresh and blacklist checking.
[y]es / [n]o / [e]dit: y
Committed successfully ✓Perfect for teams and open source projects.
$ gcommit
feat: add user profile page
Implement user profile with avatar upload and bio editing.
Add validation for profile fields.Clean and concise, no prefixes.
$ gcommit --format simple
add user profile page with avatar uploadDefine your own template in config file:
commit:
format: custom
custom_template: |
[{type}] {subject}
{body}
Signed-off-by: Your Name <your@email.com>Create ~/.config/gcommit/config.yaml for global settings or .gcommit.yaml in your project:
llm:
api_key: sk-your-key-here
model: gpt-4o-mini # or gpt-4o for even better quality
temperature: 0.3 # lower = more consistent
max_tokens: 500
commit:
language: english # or spanish, german, etc.
format: conventional # conventional, simple, or customPriority order: --config flag → GCOMMIT_CONFIG env → Local .gcommit.yaml → XDG home config → Defaults
- CLI flag:
gcommit --config /path/to/config.yaml - Environment variable:
export GCOMMIT_CONFIG=/path/to/config.yaml - Local config:
.gcommit.yamlin project directory (searched up to git root) - XDG home config:
~/.config/gcommit/config.yaml(auto-created on first run)
export OPENAI_API_KEY='sk-your-key-here'
export OPENAI_BASE_URL='https://api.openai.com/v1' # optional
export GCOMMIT_MODEL='gpt-4o-mini'
export GCOMMIT_LANGUAGE='english'
export GCOMMIT_FORMAT='conventional'gcommit # Interactive mode (default)gcommit --auto # For CI/CD or when you trust the AIgcommit --edit # Opens your $EDITOR to refine the messagegcommit -m "fixing memory leak in cache"
# AI will use your hint to generate better messagegcommit --format simple # Override config for one commitgcommit --verbose # See the prompt, API call details, tokens usedgcommit --model gpt-4o # Use more powerful model for complex changesgcommit --config /path/to/config.yaml # Use specific config filegcommit doctor # Verify config, API key, connectivitygcommit completion --install # Install for current shell (bash/zsh/fish)gcommit --version # Show versionecho "alias gc='gcommit'" >> ~/.zshrc
# Now just type: gcgit add . && gcommit --auto && git push# .gcommit.yaml in your project
commit:
language: english
format: conventional
llm:
model: gpt-4o-mini
temperature: 0.2 # More consistent for team projectsgcommit # Generate commit
git log -1 --pretty=format:"%B" # Review last commit message
git push # Push when satisfiedgcommit registers as git-ai-commit, so you can call it directly as a git subcommand:
git ai-commit
git ai-commit --auto
git ai-commit --format simplellm:
base_url: https://your-llm-proxy.com/v1
api_key: your-proxy-key
model: gpt-4o-miniModern IDEs like Cursor, Windsurf, and Zed have built-in AI commit features. So why gcommit?
| Feature | gcommit | AI IDEs (Cursor, etc.) | CLI tools (Aider) |
|---|---|---|---|
| Works over SSH | ✅ | ❌ | ✅ |
| No IDE dependency | ✅ | ❌ | ✅ |
| Custom commit formats | ✅ Full control | ||
| Any language output | ✅ | ||
| Self-hosted LLMs | ✅ | ✅ | |
| Focused on commits | ✅ | ❌ General-purpose | ❌ General-purpose |
TL;DR:
- Server work? →
gcommit(no GUI needed) - Custom team standards? →
gcommit(full template control) - Already in IDE? → Use IDE feature, it's fine
- Privacy-first? →
gcommitwith local Ollama/vLLM
Do I need an OpenAI API key?
Yes, but it's very affordable! Using gpt-4o-mini, you'll spend pennies even with dozens of commits per day. Get your key at https://platform.openai.com/api-keys
Can I use other LLM providers?
Yes! Set base_url in your config to any OpenAI-compatible API endpoint (Anthropic, local models via Ollama, etc.)
Will it commit automatically?
No, by default it asks for confirmation. Use --auto flag only when you trust the AI completely.
What if I don't like the generated message?
Press e to edit in your favorite editor, or n to cancel and write manually.
Does it work with pre-commit hooks?
Yes! The commit is made via standard git, so all hooks run normally.
Can I use it for multiple commits?
Absolutely! Stage the specific files you want (git add file1 file2) and run gcommit.
Found a bug? Have a feature request? PRs and issues welcome!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing) - Make your changes
- Use
gcommitto commit 😉 - Push and open a PR
# Install uv (via Homebrew)
brew install uv
# Clone and setup
git clone https://github.com/OpsDevil/gcommit.git
cd gcommit
uv sync
# Run locally
uv run gcommit --help
# Run tests
uv run pytest
# Or activate venv
source .venv/bin/activate
gcommit --helpMIT License - see LICENSE for details.
If gcommit saves you time, give it a star on GitHub! It helps others discover the tool.
Made with ❤️ by developers who are tired of writing commit messages