AI-powered git commit message generator using Google's Gemini AI. Automatically create professional, conventional commit messages from your staged changes.
- π€ AI-Powered: Uses Google Gemini to analyze your changes and generate meaningful commit messages
- π Conventional Commits: Follows the Conventional Commits standard
- β‘ Easy to Use: Simple CLI with multiple modes (auto, interactive, dry-run)
- π― Smart Analysis: Intelligently summarizes large diffs to focus on key changes
- π§ Configurable: Customize behavior with YAML config files
- π Quick Setup: One-command installation with automated scripts
- Python 3.7 or higher
- Git
- Google Gemini API key
Cross-Platform (Python):
git clone https://github.com/LemonMantis5571/Git-AutoCommit.git
cd Git-AutoCommit
python install.pyLinux/Mac (Shell Script):
git clone https://github.com/LemonMantis5571/Git-AutoCommit.git
cd Git-AutoCommit
chmod +x install.sh
./install.shThe installation script will:
- Check for Python and Git
- Install the package and dependencies
- Set up your API key (environment variable)
- Let you choose a Gemini model (gemini-2.5-flash, gemini-2.5-pro, etc.)
- Create the
git aicalias (optional) - Show usage instructions
After installation, use: python -m git_suggest
# Clone the repository
git clone https://github.com/LemonMantis5571/Git-AutoCommit.git
cd Git-AutoCommit
# Install the package
pip install -e .
# Set your API key (choose one method)
# Windows:
setx api_key "YOUR_GEMINI_API_KEY"
# Linux/Mac (add to ~/.bashrc or ~/.zshrc):
export api_key="YOUR_GEMINI_API_KEY"
# Optional: Create git alias
git config --global alias.aic '!python -m git_suggest'pip install git+https://github.com/LemonMantis5571/Git-AutoCommit.git# Stage your changes
git add .
# Generate and commit with AI message
python -m git_suggestpython -m git_suggest --help # Show help message
python -m git_suggest --version # Show version
python -m git_suggest --dry-run # Preview message without committing
python -m git_suggest --interactive # Review/edit message before committing
python -m git_suggest --config PATH # Use custom config file
python -m git_suggest --verbose # Enable verbose outputIf you set up the git aic alias during installation:
git add .
git aic # Same as python -m git_suggestInteractive mode lets you review, edit, or regenerate the message before committing:
python -m git_suggest --interactiveYou'll see:
============================================================
Generated commit message:
============================================================
feat: add user authentication endpoint
============================================================
Options: [c]ommit, [e]dit, [r]egenerate, [a]bort:
- c: Commit with the generated message
- e: Edit the message manually
- r: Ask AI to generate a new message
- a: Abort without committing
Preview the AI-generated message without committing:
python -m git_suggest --dry-runOutput:
feat: add user authentication endpoint
Create a .gitcommit.yml file in your home directory (~/.gitcommit.yml) or project root:
# Google Gemini model to use
model: gemini-2.0-flash-exp
# Maximum diff lines before summarization
max_diff_lines: 300
# Environment variable name for API key
api_key_env: api_keySee .gitcommit.yml.example for more details.
Generated messages follow the Conventional Commits specification:
| Type | Description | Example |
|---|---|---|
feat: |
New features | feat: add user login endpoint |
fix: |
Bug fixes | fix: resolve null pointer in auth |
docs: |
Documentation | docs: update API documentation |
style: |
Code style/formatting | style: format code with prettier |
refactor: |
Code refactoring | refactor: simplify user service |
test: |
Tests | test: add unit tests for auth |
chore: |
Maintenance | chore: update dependencies |
Solution:
- Make sure you've set the environment variable
- Windows: Restart your terminal after running
setx - Linux/Mac: Run
source ~/.bashrcor restart terminal
Verify it's set:
# Windows (PowerShell)
echo $env:api_key
# Linux/Mac
echo $api_keyPossible causes:
- Invalid API key
- No internet connection
- API quota exceeded
Solution: Verify your API key at Google AI Studio
Solution: Stage files before running:
git add <files>
git-suggestSolution: Make sure the package is installed:
pip install -e .Or use the full Python module path:
python -m git_suggest$ git add src/auth.py
$ python -m git_suggest
[main abc1234] feat: add JWT authentication
1 file changed, 45 insertions(+)$ git add .
$ python -m git_suggest --interactive
============================================================
Generated commit message:
============================================================
refactor: restructure database models
============================================================
Options: [c]ommit, [e]dit, [r]egenerate, [a]bort: c
[main def5678] refactor: restructure database models
3 files changed, 120 insertions(+), 45 deletions(-)$ git add README.md
$ python -m git_suggest --dry-run
docs: update installation instructionsContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Powered by Google Gemini AI
- Follows Conventional Commits specification
Made by LemonMantis5571