CommitCraft

AI-powered git commit message generator using FREE Google Gemini API

CommitCraft uses Google's Gemini AI to analyze your code changes and automatically generate meaningful, conventional commit messages. Completely FREE - no credit card required.

License: MIT

Features

  • 100% FREE - Uses Google's free Gemini API
  • AI-Powered - Uses latest Gemini models to understand your code
  • Multiple Suggestions - Get 3 different commit message options
  • Multiple Styles - Conventional, Semantic, Descriptive, or Custom
  • Jira Integration - Automatic ticket key prepending
  • Interactive CLI - Beautiful terminal interface
  • Context-Aware - Considers branch names, files, and history
  • Fast & Easy - One command to generate and commit

Installation

gem install commitcraft

Or add to your Gemfile:

gem 'commitcraft'

Setup

Get Your FREE API Key

  1. Go to https://aistudio.google.com/app/apikey
  2. Click "Create API Key"
  3. Copy your key

Set Your API Key

export GEMINI_API_KEY='your-key-here'

# Make it permanent:
echo 'export GEMINI_API_KEY="your-key"' >> ~/.bashrc
source ~/.bashrc

Use It

cd your-project
git add .
commitcraft generate

Usage

Basic Usage

git add .
commitcraft generate

CommitCraft will:

  • Analyze your staged changes
  • Generate 3 commit message suggestions
  • Let you choose one (or write your own)
  • Commit with your selected message

Command Options

commitcraft generate --auto-commit              # Auto-commit with first suggestion
commitcraft generate --style semantic           # Use specific commit style
commitcraft generate --all                      # Include all changes
commitcraft generate --amend                    # Amend previous commit
commitcraft generate --include-history          # Include commit history as context
commitcraft generate --jira CF-123              # Add Jira ticket key

Jira Integration

Automatically prepend Jira ticket keys to your commit messages:

# One-time Jira key
commitcraft generate --jira CF-123

# Short form
commitcraft generate -j CF-123

# Combined with other options
commitcraft generate -j CF-123 -s semantic -y

Output:

Choose a commit message:
  [CF-123] feat(auth): add OAuth2 authentication
  [CF-123] feat: implement user  system
  [CF-123] Add authentication with OAuth2

Set default Jira prefix:

# Set once for all commits
commitcraft config --jira-prefix CF-123

# Now every commit includes CF-123 automatically
commitcraft generate

Supported formats:

  • PROJECT-123
  • ABC-456
  • JIRA-789

Commit Styles

Conventional (default)

feat(auth): add OAuth2  flow
fix(api): resolve null pointer error
docs(readme): update installation steps

Semantic

Add user authentication middleware
Fix memory leak in background worker
Update dependencies to latest versions

Descriptive

Implement caching to improve response time by 40%
Refactor database queries to eliminate N+1 problems
Add comprehensive error handling for edge cases

Configuration

commitcraft config --show                       # Show current config
commitcraft config --style conventional         # Set default style
commitcraft config --model gemini-2.5-flash     # Set AI model
commitcraft config --jira-prefix CF-123         # Set default Jira prefix
commitcraft status                              # View git status
commitcraft version                             # Check version

Available Models (All FREE)

  • gemini-2.5-flash (default) - Best balance
  • gemini-2.5-pro - Highest quality
  • gemini-2.5-flash-lite - Fastest
  • gemini-2.0-flash - Fast and versatile
  • gemini-flash-latest - Auto-updates to latest

Git Alias

Add to ~/.gitconfig:

[alias]
    ai = !commitcraft generate
    aic = !commitcraft generate --auto-commit

Then use:

git ai              # Interactive mode
git aic             # Auto-commit

Set Default for Long-Running Work

# Working on CF-123 all week
commitcraft config --jira-prefix CF-123

# All commits include CF-123
git add file1.rb && commitcraft generate -y
git add file2.rb && commitcraft generate -y
git add file3.rb && commitcraft generate -y

Git History with Jira

$ git log --oneline

a1b2c3d [CF-123] feat(auth): add OAuth2 authentication
d4e5f6g [CF-123] test(auth): add integration tests
h7i8j9k [CF-456] fix(api): resolve validation error
l0m1n2o [CF-456] docs(api): update API documentation

Filter by ticket:

git log --grep="CF-123" --oneline

Rate Limits (Free Tier)

  • 15 requests/minute
  • 1 million tokens/minute
  • 1,500 requests/day

Contributing

Bug reports and pull requests are welcome.

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT License - see LICENSE.txt

Tips

  1. Stage related changes together for better commit messages
  2. Use --include-history for context-aware suggestions
  3. Try different styles to match your team's conventions
  4. Set default Jira prefix for long-running feature work
  5. Use --auto-commit for quick, simple changes
  6. Create git aliases for faster workflow