Skip to content

개발에만 집중하세요! AI-Commit이 당신의 코드 변경사항을 분석하여 명확하고 표준화된 커밋 메시지를 자동으로 생성합니다. 더 이상 커밋 메시지 작성에 시간을 낭비하지 마세요.

Notifications You must be signed in to change notification settings

in-jun/ai-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ai-commit

Version Go Report Card

AI-powered Git commit message generator using Google Gemini. Analyzes staged changes, understands project context, and creates Conventional Commits-compliant messages.

Quick Start

# Install
go install github.com/in-jun/ai-commit@latest

# Configure API key
ai-commit init  # Enter your Google AI Studio API key

# Use
git add .
ai-commit

Requirements

Installation

macOS/Linux

# Install Go (if needed)
brew install go  # macOS
sudo apt install golang-go  # Ubuntu

# Install ai-commit
go install github.com/in-jun/ai-commit@latest

# Add to PATH
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.zshrc  # macOS
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc  # Linux

Windows

# Install Go from https://go.dev/dl/
# Install ai-commit
go install github.com/in-jun/ai-commit@latest

# Add to PATH
$env:Path += ";$(go env GOPATH)\bin"
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$(go env GOPATH)\bin", [EnvironmentVariableTarget]::User)

Configuration

Configure via ~/.ai-commit/config.yaml:

api_key: "your-gemini-api-key"
model: "gemini-1.5-flash" # Available: flash, pro, 2.0-flash, 2.0-flash-lite
max_diff_size: 10000 # Maximum diff size in bytes
history_depth: 5 # Previous commits to analyze
color_enabled: true # Colored output

templates:
  - prefix: "feat"
    description: "New feature"
  - prefix: "fix"
    description: "Bug fix"
  - prefix: "docs"
    description: "Documentation"
  - prefix: "refactor"
    description: "Code refactoring"
  # Add custom types as needed

Usage

Basic Workflow

git add <files>
ai-commit

# Review generated message
# Y/Enter: Accept and commit
# E: Edit message
# N: Cancel

Commands

Command Description
ai-commit Generate commit message
ai-commit init Initialize configuration
ai-commit -v Show version
ai-commit -h Show help

Model Selection

Choose models based on your needs:

Model Performance Accuracy Daily Limit Use Case
gemini-1.5-flash ⚡⚡⚡ ★★★ 1,500 Default, balanced
gemini-1.5-pro ★★★★★ 50 Complex changes
gemini-2.0-flash ⚡⚡ ★★★★ 1,500 Latest features
gemini-2.0-flash-lite ⚡⚡⚡⚡ ★★ 1,500 Simple commits

Update model in config:

model: "gemini-1.5-pro" # For complex analysis

Features

  • Context-aware: Analyzes previous commits for consistent style
  • Multi-model support: Choose from 4 Gemini models
  • Interactive editing: Review and modify messages before committing
  • Conventional Commits: Follows industry standards
  • Language detection: Adapts to project's commit language
  • Customizable templates: Define project-specific commit types

Example Output

=== Generated Commit Message ===
feat: implement JWT authentication middleware

Add token-based authentication system for API endpoints
- Create token validation middleware
- Implement protected route handling
- Add 401/403 error responses
- Include token refresh mechanism

What would you like to do?
[Y]es: Commit with this message
[E]dit: Edit the message
[N]o: Cancel commit
Choice [Y/e/n]:

Advanced Configuration

Custom Commit Types

templates:
  - prefix: "security"
    description: "Security updates"
  - prefix: "perf"
    description: "Performance improvements"
  - prefix: "deploy"
    description: "Deployment changes"

Editor Setup

# Set preferred editor
export EDITOR="vim"           # Linux/macOS
$env:EDITOR="code --wait"     # Windows PowerShell

Troubleshooting

Command Not Found

# Verify installation
go version
ls $(go env GOPATH)/bin/ai-commit

# Fix PATH
export PATH=$PATH:$(go env GOPATH)/bin

API Key Issues

# Check configuration
cat ~/.ai-commit/config.yaml

# Reinitialize
ai-commit init

# Use environment variable
export API_KEY="your-key"

Model Errors

  • Rate limit exceeded: Switch to gemini-2.0-flash-lite for higher limits
  • Complex changes failing: Use gemini-1.5-pro for better analysis
  • Timeout issues: Check network connection and API status

Best Practices

  1. Atomic commits: Stage related changes together
  2. Review messages: Always verify AI-generated content
  3. Model selection: Use appropriate model for change complexity
  4. Custom templates: Align with team conventions

For issues and updates: github.com/in-jun/ai-commit

About

개발에만 집중하세요! AI-Commit이 당신의 코드 변경사항을 분석하여 명확하고 표준화된 커밋 메시지를 자동으로 생성합니다. 더 이상 커밋 메시지 작성에 시간을 낭비하지 마세요.

Topics

Resources

Stars

Watchers

Forks

Languages