AI-powered git commit message generator that analyzes your staged changes and creates semantic commit messages matching your project's style.
- 🤖 AI-Powered: Uses LLMs to generate meaningful commit messages
- 📝 Semantic Commits: Follows Conventional Commits format automatically
- 🎨 Style Matching: Learns from your project's commit history
- ⚡ Fast: Minimal latency with streaming responses
- 🔧 Configurable: Supports multiple LLM providers (OpenAI-compatible APIs)
- 🎯 Git Native: Works seamlessly with your existing git workflow
pip install smart-git-commituv pip install smart-git-commit- Configure the tool (first run):
sgc --config- Generate a commit message:
git add .
sgc- Quick commit mode (skip review):
sgc --silence$ git add src/models.py
$ sgc
Analyzing staged changes... ✓
Detecting project style... ✓
Generating commit message... ✓
┌─────────────────────────────────────────────────────────────┐
│ Generated Commit Message │
├─────────────────────────────────────────────────────────────┤
│ feat(models): add user authentication │
│ │
│ - Add User model with email and password fields │
│ - Implement password hashing │
│ - Add validation logic │
└─────────────────────────────────────────────────────────────┘
Edit message? [y/N]: n
Proceed with commit? [Y/n]: y
[main a1b2c3d] feat(models): add user authentication
1 file changed, 85 insertions(+)| Command | Description |
|---|---|
sgc |
Generate commit message interactively |
sgc --config |
Run configuration wizard |
sgc --silence |
Skip prompts and commit directly |
sgc --help |
Show help information |
sgc --version |
Show version |
Configuration is stored in ~/.smart-git-commit.yaml:
llm:
base_url: "https://api.openai.com/v1"
model: "gpt-4o-mini"
api_key: "${OPENAI_API_KEY}" # Uses environment variable
timeout_seconds: 30
style:
language: "en_US"
use_semantic_commits: true
max_diff_tokens: 4000
behavior:
auto_commit_silence: false
confirm_before_commit: trueYou can also create a project-level .smart-git-commit.yaml for per-project settings.
- Python 3.11+
- Git repository
- OpenAI-compatible API key
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.