A smart CLI tool that analyzes your staged Git changes and generates conventional commit messages automatically.
- 📝 Analyzes
git diff --stagedto understand your changes - 🎨 Generates conventional commit messages (feat, fix, docs, style, refactor, test, chore)
- 🔍 Detects change patterns: new files, deletions, modifications, renames
- 💡 Suggests scope based on file paths
- ⚡ Fast and lightweight - pure Python with no external dependencies
- 🎭 Interactive mode to review and edit suggestions
# Clone the repository
git clone https://github.com/miasus-agentic/commit-msg-gen.git
cd commit-msg-gen
# Make it executable
chmod +x commit-gen.py
# Optional: Add to PATH
sudo ln -s $(pwd)/commit-gen.py /usr/local/bin/commit-gen# Stage your changes
git add .
# Generate commit message
./commit-gen.py
# Or if installed globally
commit-genAnalyzing staged changes...
Suggested commit message:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
feat(api): add user authentication endpoints
- Add POST /api/auth/login endpoint
- Add POST /api/auth/register endpoint
- Add JWT token generation utility
- Update API documentation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Use this message? [Y/n/e(dit)]:
The tool automatically detects the appropriate commit type:
feat: New featuresfix: Bug fixesdocs: Documentation changesstyle: Code style changes (formatting, semicolons, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks (dependencies, config, etc.)perf: Performance improvementsci: CI/CD changesbuild: Build system changes
- Runs
git diff --staged --statto get file change statistics - Analyzes file paths and change patterns
- Detects the primary type of change
- Extracts scope from common file path patterns
- Generates a descriptive commit message following conventional commits spec
- Presents the message for review
- Python 3.6+
- Git
MIT License - feel free to use and modify!
Contributions welcome! Feel free to open issues or submit pull requests.