Skip to content

miasus-agentic/git-smart-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 Commit Message Generator

A smart CLI tool that analyzes your staged Git changes and generates conventional commit messages automatically.

Features

  • 📝 Analyzes git diff --staged to 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

Installation

# 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

Usage

# Stage your changes
git add .

# Generate commit message
./commit-gen.py

# Or if installed globally
commit-gen

Example Output

Analyzing 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)]:

Commit Types

The tool automatically detects the appropriate commit type:

  • feat: New features
  • fix: Bug fixes
  • docs: Documentation changes
  • style: Code style changes (formatting, semicolons, etc.)
  • refactor: Code refactoring
  • test: Adding or updating tests
  • chore: Maintenance tasks (dependencies, config, etc.)
  • perf: Performance improvements
  • ci: CI/CD changes
  • build: Build system changes

How It Works

  1. Runs git diff --staged --stat to get file change statistics
  2. Analyzes file paths and change patterns
  3. Detects the primary type of change
  4. Extracts scope from common file path patterns
  5. Generates a descriptive commit message following conventional commits spec
  6. Presents the message for review

Requirements

  • Python 3.6+
  • Git

License

MIT License - feel free to use and modify!

Contributing

Contributions welcome! Feel free to open issues or submit pull requests.

About

Intelligent Git commit message generator - analyzes your staged changes and suggests conventional commit messages

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages