Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

maxgfr/git-pilot

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-pilot

License: MIT Shell: Bash

AI-powered git automation: smart commits, conflict resolution, and auto-rebase. Pure Bash.

Features

  • AI commit messages — Generate meaningful commit messages from your staged diff (title only by default, optional bullet points with --bullets)
  • Multi-provider — Claude Code & Codex (CLI), Anthropic, OpenAI, Gemini & Mistral (API)
  • CLI-first — Uses claude and codex CLIs directly — no API key needed for those
  • Budget-friendly defaults — Uses cheap/mini models by default (haiku, gpt-5-mini, gemini-2.5-flash-lite, mistral-small-latest)
  • Smart diff truncation — Prioritizes small file diffs to maximize info sent to the AI (16K chars budget)
  • Conflict resolution — AI-powered merge conflict resolution
  • Auto-rebasepull --rebase with automatic conflict resolution
  • Conventional Commits — Optional formatting with --conventional
  • Emoji support — Add emoji to commit messages with --emoji
  • Multi-language — Generate commit messages in any language
  • Dry run — Preview commit messages without committing
  • Pure Bash — Single script, no heavy runtime dependencies

Installation

Homebrew

brew install maxgfr/tap/git-pilot

Manual

curl -fsSL https://raw.githubusercontent.com/maxgfr/git-pilot/main/script.sh -o git-pilot
chmod +x git-pilot
sudo mv git-pilot /usr/local/bin/

Prerequisites

For CLI providers (no API key needed):

For API providers:

  • curl and jq (installed automatically if missing)
  • An API key for the chosen provider

Quick Start

# 1. Configure your provider
git-pilot setup

# 2. Stage your changes and generate a commit
git add .
git-pilot

With Claude Code (default), no API key is needed — just have claude installed.

Usage

git-pilot [command] [options]

Commands

Command Description
commit Generate AI commit message and commit (default)
<type> Force conventional commit type (feat, fix, docs, refactor, chore, style, test, perf, ci, build, revert)
resolve Resolve merge conflicts with AI
rebase Pull --rebase with AI conflict resolution
setup Run interactive configuration wizard
config Show current configuration

Options

Flag Short Description
--provider <name> -p Provider: claude-code, codex, anthropic, openai, gemini, mistral
--model <name> -m Model name (e.g. haiku, gpt-5-mini, claude-haiku-4-5)
--api-key <key> API key (for API providers: anthropic, openai, gemini, mistral)
--dry-run -d Preview commit message without committing
--auto-stage -a Stage all changes before commit
--auto-push -P Push after commit
--conventional -c Use Conventional Commits format
--emoji -e Add emoji to commit message
--lang <code> -l Language for commit message (e.g. en, fr, es)
--bullets -B Include bullet points in description
--no-bullets Title only, no bullet points (default)
--yes -y Skip confirmation prompts
--version -v Show version
--help -h Show help

Examples

# Basic commit with Claude Code (default, uses haiku)
git add .
git-pilot

# Auto-stage + conventional commits + emoji
git-pilot -a -c -e

# Force a conventional commit type
git-pilot fix
git-pilot feat -B    # 'feat' type, with bullet points

# Dry run (preview only)
git-pilot -d

# Use Codex CLI
git-pilot -p codex

# Use Anthropic API
git-pilot -p anthropic

# Use OpenAI API with a specific model
git-pilot -p openai -m gpt-5-mini

# Commit in French
git-pilot -l fr

# Resolve merge conflicts with AI
git-pilot resolve

# Pull --rebase with AI conflict resolution
git-pilot rebase

# Show current config
git-pilot config

# Non-interactive mode (auto-stage + skip confirm + push)
git-pilot -a -y -P

Configuration

Configuration is stored at ~/.config/git-pilot/config (XDG-compliant) with chmod 600 to protect your API key.

# git-pilot configuration
provider=claude-code
api_key=
model=haiku
max_tokens=1024
auto_stage=false
auto_push=false
language=en
conventional=true
emoji=false
bullets=false
skip_confirm=false

You can view your active configuration at any time with git-pilot config.

Environment Variables

API keys can be provided via environment variables (fallback for API providers):

Provider Environment Variable
Anthropic ANTHROPIC_API_KEY
OpenAI OPENAI_API_KEY
Gemini GEMINI_API_KEY or GOOGLE_API_KEY
Mistral MISTRAL_API_KEY

CLI providers (claude-code, codex) don't need API keys — they use their own authentication.

Supported Providers

Provider Type Default Model Cost
claude-code CLI haiku Free (uses your Claude subscription)
codex CLI gpt-5-mini Free (uses your OpenAI auth)
anthropic API claude-haiku-4-5 ~$1.00/M input tokens
openai API gpt-5-mini ~$0.25/M input tokens
gemini API gemini-2.5-flash-lite ~$0.075/M input tokens
mistral API mistral-small-latest ~$0.06/M input tokens

All default models are cheap/mini models — more than enough for generating commit messages.

License

MIT


Inspired by claude-auto-commit.

About

AI-powered git automation: smart commits, conflict resolution, and auto-rebase. Supports Claude Code, Codex (CLI), OpenAI, Gemini, Mistral (API). Pure Bash.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.