Skip to content

Latest commit

 

History

History
162 lines (114 loc) · 4.61 KB

File metadata and controls

162 lines (114 loc) · 4.61 KB

auto-commit

AI-powered Git commit message generator - supports OpenAI / DeepSeek / Gemini

License: MIT Rust Crates.io

🌐 Languages: 日本語 | 简体中文 | 繁體中文 | Русский | العربية | فارسی

Overview

auto-commit is a CLI tool that analyzes staged changes and automatically generates appropriate commit messages. This project is a fork of m1guelpf/auto-commit, adding support for multiple LLM providers (OpenAI, DeepSeek, Gemini) and customizable commit message formatting.

Features

  • 🤖 Multi-provider support: Choose from OpenAI, DeepSeek, or Google Gemini
  • 🎨 Custom formatting: Freely customize message format with --format option
  • 📝 .gitmessage templates: Set project-specific commit rules
  • 🚀 Fast execution: Built with Rust for lightweight and fast performance
  • 🔧 Flexible configuration: Manage settings via environment variables or .env files
  • 🌍 Multi-platform: Supports Windows, macOS, and Linux

Installation

Homebrew (macOS / Linux)

brew tap clearclown/tap
brew install auto-commit

Cargo (Rust)

# From crates.io
cargo install auto-commit

# Directly from GitHub repository
cargo install --git https://github.com/clearclown/auto-commit.git

Binary Download

Download binaries for your platform from GitHub Releases:

Platform File
macOS (Apple Silicon) auto-commit-darwin-aarch64
macOS (Intel) auto-commit-darwin-x86_64
Linux (x86_64) auto-commit-linux-x86_64
Linux (deb) auto-commit-linux-x86_64.deb
Windows (x86_64) auto-commit-win-x86_64.exe
# Example: macOS (Apple Silicon)
curl -LO https://github.com/clearclown/auto-commit/releases/latest/download/auto-commit-darwin-aarch64
chmod +x auto-commit-darwin-aarch64
sudo mv auto-commit-darwin-aarch64 /usr/local/bin/auto-commit

Build from Source

git clone https://github.com/clearclown/auto-commit.git
cd auto-commit
cargo build --release
sudo mv target/release/auto-commit /usr/local/bin/

Setup

API Key Configuration

Set the API key for your LLM provider as an environment variable. If multiple keys are set, they are automatically selected by priority.

Priority: OPENAI_API_KEY > DEEPSEEK_API_KEY > GEMINI_API_KEY

# Use OpenAI
export OPENAI_API_KEY='sk-...'

# Use DeepSeek
export DEEPSEEK_API_KEY='sk-...'

# Use Google Gemini
export GEMINI_API_KEY='AIza...'

Or create a .env file in your project root:

OPENAI_API_KEY='sk-...'
# DEEPSEEK_API_KEY='sk-...'
# GEMINI_API_KEY='AIza...'

Usage

Basic Usage

# Stage changes
git add .

# Auto-generate and commit
auto-commit

The provider being used is displayed during execution:

⠋ Generating commit message using OpenAI...
✓ Commit message generated (OpenAI)

Options

# Dry run (don't actually commit)
auto-commit --dry-run

# Review generated message before committing
auto-commit --review

# Force execution (no confirmation)
auto-commit --force

# Custom format
auto-commit --format "{emoji} {prefix}: {title}"

# Verbose logging
auto-commit -v

Format Placeholders

Placeholder Description Example
{title} Commit summary (first line) Add user authentication
{description} Detailed description Implemented JWT-based auth...
{emoji} GitMoji-style emoji , 🐛, 📝
{prefix} Conventional Commits prefix feat, fix, docs
{scope} Change scope (optional) api, cli, config

Supported Providers

Provider Default Model Environment Variable
OpenAI gpt-4o-mini OPENAI_API_KEY
DeepSeek deepseek-chat DEEPSEEK_API_KEY
Google Gemini gemini-2.0-flash GEMINI_API_KEY

License

MIT License - See LICENSE file for details.

Links