AI-powered Git commit message generator using OpenAI's GPT. It analyzes your staged changes and generates meaningful, conventional commit messages.
- 🧠 Intelligent commit message generation
- 📝 Conventional commit format
- ⚙️ Project-specific customization
- 🔄 Automatic staging of tracked changes
- 🎨 Beautiful and descriptive commit messages
- Python 3.8 or later
- Git
- OpenAI API key
Supported platforms:
- Linux (Ubuntu, Debian, etc.)
- macOS
# Download and run installer
curl -fsSL https://raw.githubusercontent.com/dsabolo/git-commit-ai/main/install-remote.sh | bash# Set your OpenAI API key (replace with your actual key)
export OPENAI_API_KEY='your-api-key-here'# Add to your shell config for permanent use:
echo 'export OPENAI_API_KEY="your-api-key-here"' >> ~/.bashrc # or ~/.zshrc
source ~/.bashrc # or ~/.zshrcThe installer will:
- Install Python dependencies in your user space
- Set up the Git command
- Create example configuration
- Clone this repository:
git clone https://github.com/dsabolo/git-commit-ai.git
cd git-commit-ai- Run the installer:
bash install.sh- Set your OpenAI API key:
# Add to ~/.bashrc or ~/.zshrc:
export OPENAI_API_KEY='your-api-key-here'
source ~/.bashrc # or ~/.zshrcYou can customize the commit message format by creating a .git-commit-ai.yml file in your repository root:
# System prompt for the AI
system_prompt: |
You are a helpful assistant that generates clear and concise Git commit messages.
Follow these rules:
1. Use conventional commit format (feat, fix, docs, etc.)
2. Keep the title short and descriptive
3. List all changes in bullet points
4. Be specific about modifications
# Prompt for generating commit messages
commit_prompt: |
Generate a commit message for the following changes.
Current branch: {branch}
Changed files:
{files}
Git diff:
{diff}
Return only:
1. A high-level title
2. A list of bullet points
# Template for the final commit message
commit_template: "feat({branch}): {message}"-
Make some changes to your code
-
Run:
git commit-aiThe tool will:
- Stage any modified tracked files (like
git commit -am) - Generate a commit message using AI
- Open your default Git editor to review/edit the message
- Create the commit when you save and exit
- Cancel the commit if you exit without saving
feat(auth): Add user authentication system
- Create User model with email and password fields
- Implement JWT token generation and validation
- Add login and register endpoints
- Set up password hashing with bcrypt
- Add user authentication middleware
# Run the uninstaller
./uninstall.shContributions are welcome! Please feel free to submit a Pull Request.