Automatically generate professional commit messages using Google Gemini AI for macOS, Linux, and Windows
GCommit is an intelligent Git commit message generator that uses Google Gemini AI to create professional, conventional commit messages automatically. Perfect for developers who want to maintain consistent commit history without the hassle of writing commit messages manually.
Platform | Repository | Description |
---|---|---|
π macOS | GhufranBkri/gcommit | Main repository with macOS support |
π§ Linux/Ubuntu | MhmmdIchsan/gcommit-ubuntu | Optimized for Ubuntu/Linux systems |
πͺ Windows | Papazy/gcommit-windows | Windows-compatible version |
- π€ AI-Powered: Leverages Google Gemini AI for intelligent commit message generation
- π Professional Format: Follows Conventional Commits standard automatically
- β‘ Fast & Simple: One command to analyze changes and commit
- π¨ Beautiful Interface: Clean terminal UI with animated loading spinners
- π Secure: Uses environment variables for API key management
- π Cross-Platform: Works on macOS, Linux, and Windows
- π Auto-Push Support: Commit and push in one command
- π Smart Validation: Validates Git repository and push parameters
$ gcommit
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π GCOMMIT - AI Git Commit Generator β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β API Key OK
β Repository: my-awesome-project
β Files staged: 3
π src/auth.py
π tests/test_auth.py
π README.md
β Generating commit message...
β Commit message generated
ββ Commit Message ββββββββββββββββββββββββββββββββββββββββββ
β feat: add user authentication with JWT tokens β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Continue with commit? [Y/n]: y
β Commit successful [a1b2c3d4]
β¨ Commit completed!
$ gcommit --push origin main
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π GCOMMIT - AI Git Commit Generator β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β API Key OK
β Repository: my-awesome-project
β Push target: origin/main
β Files staged: 2
β Generating commit message...
β Commit message generated
ββ Commit Message ββββββββββββββββββββββββββββββββββββββββββ
β fix: resolve memory leak in user session handler β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Continue with commit and push to origin/main? [Y/n]: y
β Commit successful [b2c3d4e5]
β Pushing to origin/main...
β Push successful to origin/main
β¨ Commit and push completed!
- Python 3.7+: Check with
python3 --version
- Git: Check with
git --version
- Google Gemini API Key: Get from Google AI Studio
-
Clone the repository
git clone https://github.com/GhufranBkri/gcommit.git cd gcommit
-
Install Python dependencies
# Option A: System-wide (with override) pip3 install --break-system-packages GitPython google-generativeai # Option B: User installation (safer) pip3 install --user GitPython google-generativeai
-
Make executable
chmod +x gcommit
-
Add to PATH (choose one method):
Temporary (current session only):
export PATH="$(pwd):$PATH"
Permanent (recommended):
# For Zsh (default on macOS) echo 'export PATH="/path/to/gcommit:$PATH"' >> ~/.zshrc source ~/.zshrc # For Bash echo 'export PATH="/path/to/gcommit:$PATH"' >> ~/.bash_profile source ~/.bash_profile
-
Clone and setup
git clone https://github.com/GhufranBkri/gcommit.git cd gcommit
-
Create virtual environment
python3 -m venv venv source venv/bin/activate
-
Install dependencies
pip install GitPython google-generativeai
-
Create requirements.txt
pip freeze > requirements.txt
-
Make executable
chmod +x gcommit
Note: With virtual environment, you need to activate it each time:
cd /path/to/gcommit
source venv/bin/activate
-
After installing with Method 1, create global symlink:
sudo ln -sf $(pwd)/gcommit /usr/local/bin/gcommit
-
Verify installation:
which gcommit gcommit --help
For Linux/Ubuntu users, please use the dedicated optimized version:
π MhmmdIchsan/gcommit-ubuntu
Features include:
- APT package management integration
- Systemd service support
- Linux-specific installation scripts
- Distribution-specific configurations
- System-wide installation support
For Windows users, please use the dedicated Windows version:
Features include:
- Windows batch scripts (.bat files)
- PowerShell installation support
- Windows PATH handling
- Executable files (.exe)
- Windows Defender compatibility
- Visit Google AI Studio
- Sign in with your Google account
- Create a new API key
- Copy the generated key
Option A: Permanent Setup (Recommended)
# For Zsh (default on macOS Catalina+)
echo 'export GOOGLE_API_KEY="your-actual-api-key-here"' >> ~/.zshrc
source ~/.zshrc
# For Bash
echo 'export GOOGLE_API_KEY="your-actual-api-key-here"' >> ~/.bash_profile
source ~/.bash_profile
Option B: Temporary Setup (Current session)
export GOOGLE_API_KEY="your-actual-api-key-here"
Verify Setup:
echo $GOOGLE_API_KEY
Please refer to MhmmdIchsan/gcommit-ubuntu for detailed Linux-specific setup instructions.
Please refer to Papazy/gcommit-windows for detailed Windows-specific setup instructions.
-
Stage your changes:
git add . # Stage all changes git add file1.py file2.py # Stage specific files git add src/ # Stage entire directory
-
Generate commit message and commit:
gcommit
-
Commit and push in one command:
gcommit --push origin main # Push to origin/main gcommit --push upstream develop # Push to upstream/develop gcommit -p origin feature/auth # Short form
Check help:
gcommit --help
Examples:
# Basic workflow
git add .
gcommit
# Commit and push workflow
git add src/
gcommit --push origin main
# Feature branch workflow
git checkout -b feature/new-auth
git add .
gcommit --push origin feature/new-auth
Option | Short | Description | Example |
---|---|---|---|
--push |
-p |
Commit and push to remote/branch | gcommit -p origin main |
--help |
-h |
Show help message | gcommit --help |
GCommit automatically generates commit messages following the Conventional Commits specification:
feat:
- New featuresfix:
- Bug fixesdocs:
- Documentation changesstyle:
- Code style changes (formatting, etc.)refactor:
- Code refactoringtest:
- Adding or updating testschore:
- Maintenance tasks
The AI analyzes your staged changes and generates contextually appropriate commit messages by examining:
- File modifications: What files were changed
- Code additions and deletions: The actual changes made
- File types and patterns: Understanding the context
- Change scope and impact: Determining the appropriate commit type
New auto-push functionality allows you to:
- Commit and push in a single command
- Validate remote and branch existence
- Handle push errors gracefully
- Provide helpful error messages
Auto-Push Validation:
- β Checks if remote exists
- β Validates branch exists locally
- β Provides clear error messages
- β Suggests solutions for common issues
You can modify the AI model in gcommit.py
:
model_name = "gemini-1.5-flash-002" # Default model
# model_name = "gemini-pro" # Alternative model
Variable | Required | Description |
---|---|---|
GOOGLE_API_KEY |
β Yes | Your Google Gemini API key |
gcommit/
βββ gcommit # Main executable script
βββ gcommit.py # Python source code
βββ README.md # This documentation
βββ LICENSE # MIT License
βββ requirements.txt # Python dependencies (if using venv)
βββ .gitignore # Git ignore rules
Solution:
# Check if variable is set
echo $GOOGLE_API_KEY
# Set the variable (replace with your actual key)
export GOOGLE_API_KEY="your-actual-api-key-here"
# Make it permanent
echo 'export GOOGLE_API_KEY="your-actual-api-key-here"' >> ~/.zshrc
source ~/.zshrc
Solution:
# Check git status
git status
# Stage files
git add . # Stage all
git add specific-file.py # Stage specific file
Solution:
# Initialize git repository
git init
# Or navigate to existing repository
cd /path/to/your/git/repository
Solution:
# Check if gcommit is in PATH
which gcommit
# Add to PATH temporarily
export PATH="/path/to/gcommit:$PATH"
# Add to PATH permanently
echo 'export PATH="/path/to/gcommit:$PATH"' >> ~/.zshrc
source ~/.zshrc
Solution:
# Option 1: Use break-system-packages flag
pip3 install --break-system-packages GitPython google-generativeai
# Option 2: Use user installation
pip3 install --user GitPython google-generativeai
# Option 3: Use virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate
pip install GitPython google-generativeai
Solutions:
# Authentication failed
git config --global credential.helper store
# Permission denied
# Check repository permissions on GitHub/GitLab
# Non-fast-forward
git pull origin main # Pull latest changes first
- macOS Issues: Create issue
- Linux Issues: MhmmdIchsan/gcommit-ubuntu issues
- Windows Issues: Papazy/gcommit-windows issues
We welcome contributions! Here's how you can help:
-
Fork the appropriate repository for your platform:
- macOS: This repository
- Linux: gcommit-ubuntu
- Windows: gcommit-windows
-
Create a feature branch:
git checkout -b feature/amazing-feature
-
Make your changes and test them
-
Commit your changes:
git add . gcommit # Use gcommit itself! π
-
Push to your fork:
git push origin feature/amazing-feature
-
Open a Pull Request
For macOS development:
git clone https://github.com/GhufranBkri/gcommit.git
cd gcommit
python3 -m venv venv
source venv/bin/activate
pip install GitPython google-generativeai
For other platforms:
- Linux: See MhmmdIchsan/gcommit-ubuntu
- Windows: See Papazy/gcommit-windows
- Language: Python 3.7+
- Dependencies: GitPython, google-generativeai
- License: MIT
- Platforms: macOS, Linux, Windows
- Features: AI commit generation, auto-push, conventional commits
- macOS: GhufranBkri/gcommit (Main)
- Linux/Ubuntu: MhmmdIchsan/gcommit-ubuntu
- Windows: Papazy/gcommit-windows
This project is licensed under the MIT License - see the LICENSE file for details.
If you find GCommit helpful, please consider:
- β Starring the repositories:
- π Reporting bugs on the appropriate platform repository
- π‘ Suggesting new features
- π€ Contributing to the project
- π’ Sharing with other developers
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: ghufranbakrie@gmail.com
- macOS: This repository
- Linux/Ubuntu: MhmmdIchsan/gcommit-ubuntu
- Windows: Papazy/gcommit-windows
- Be respectful and constructive
- Provide detailed information for bug reports
- Search existing issues before creating new ones
- Use appropriate repository for platform-specific issues
Keywords: git commit generator, ai commit message, conventional commits, google gemini ai, git automation, developer tools, python git tools, commit message generator, ai git helper, automated git commits, git workflow optimization, auto push, ai powered git
Made with β€οΈ by developers, for developers across all platforms.
β Star this project if it helped you!