Jump to content

AI Commit

From Archive

AI Commit

AI-powered git commit message generation integrated with lazygit. Added December 2025.

Overview

After staging files in lazygit, press a to generate three conventional commit message options via Claude CLI. Select with fzf and commit executes.

Location: ~/.dotfiles/bin/ai-commit

Flow

Stage files in lazygit (space)
    |
Hit 'a' key
    |
ai-commit gathers: staged diff, branch name, recent commits
    |
Claude returns 3 conventional commit messages
    |
fzf with diff preview (60% right pane)
    |
Select message, commit executes

Lazygit Configuration

Location: ~/.config/lazygit/config.yml

customCommands:
  - key: "a"
    context: "files"
    description: "AI commit (fzf + Claude)"
    subprocess: true
    command: 'MSG=$(ai-commit) && git commit -m "$MSG"'

Context Provided

The script provides Claude with:

  • Staged diff (what's actually changing)
  • Current branch name (for context)
  • Recent commit messages (to match style)
  • Repository name

Message Format

Returns conventional commits format:

  • feat: new features
  • fix: bug fixes
  • refactor: code restructuring
  • docs: documentation
  • chore: maintenance

See Also



Technical
Core Technical · CLI · Dotfiles · Nvim · SSH · VPS
Tools Sketchybar · ArchiveBox · ThinkPad Linux
Systems Automation · Personal APIs · Quantified Self
Reference Runbooks · New Computer Runbook · Syntax guide