展示 HN: Git 自动提交 (GAC) – 基于 LLM 的 Git 提交命令行工具
Show HN: Git Auto Commit (GAC) – LLM-powered Git commit command line tool

原始链接: https://github.com/cellwebb/gac

## gac:基于LLM的Git提交信息 **gac** 通过使用大型语言模型自动生成智能、上下文相关的提交信息,从而简化您的工作流程。只需在暂存更改后,将 `git commit -m "..."` 替换为 `gac` 即可。 **主要特性:** * **上下文理解:** 分析代码更改以解释更改的原因,识别重构、错误修复和新功能。 * **可定制输出:** 提供单行、标准(项目符号)和详细消息格式。 * **交互式和高效:** 允许通过反馈重新生成消息(例如“使其更短”),并支持一键式工作流程,如 `gac -ayp`(暂存、自动提交、推送)。 * **安全:** 包括自动检测密钥和提示潜在敏感数据。 * **提供商支持:** 与各种LLM提供商合作,包括OpenAI、Anthropic、Gemini等。 **入门:** 1. `gac init` 配置您的LLM提供商。 2. `gac` 生成并查看提交信息(使用'y'确认,使用'n'取消,或使用'r'重新生成)。

相关文章

原文

PyPI version Python Build Status codecov Ruff mypy Contributions welcome License: MIT

LLM-powered commit messages that understand your code.

Tired of writing commit messages? Replace git commit -m "..." with gac for contextual, well-formatted commit messages generated by large language models.


Intelligent, contextual messages that explain the why behind your changes:

GAC generating a contextual commit message


uvx gac init  # Configure your LLM provider
uvx gac  # Generate and commit with LLM

That's it! Review the generated message and confirm with y.

uv tool install gac
gac init
gac

  • AnthropicCerebrasChutes.aiFireworksGemini
  • GroqLM StudioOllamaOpenAIOpenRouter
  • StreamlakeSynthetic.newTogether AIZ.AIZ.AI Coding
  • Understands intent: Analyzes code structure, logic, and patterns to understand the "why" behind your changes, not just what changed
  • Semantic awareness: Recognizes refactoring, bug fixes, features, and breaking changes to generate contextually appropriate messages
  • Intelligent filtering: Prioritizes meaningful changes while ignoring generated files, dependencies, and artifacts

📝 Multiple Message Formats

  • One-liner (-o flag): Single-line commit message following conventional commit format
  • Standard (default): Summary with bullet points explaining implementation details
  • Verbose (-v flag): Comprehensive explanations including motivation, technical approach, and impact analysis

💻 Developer Experience

  • Interactive feedback: Regenerate messages with specific requests like r "make it shorter" or r "focus on the bug fix"
  • One-command workflows: Complete workflows with flags like gac -ayp (stage all, auto-confirm, push)
  • Git integration: Respects pre-commit and lefthook hooks, running them before expensive LLM operations

🛡️ Built-in Security

  • Automatic secret detection: Scans for API keys, passwords, and tokens before committing
  • Interactive protection: Prompts before committing potentially sensitive data with clear remediation options
  • Smart filtering: Ignores example files, template files, and placeholder text to reduce false positives

# Stage your changes
git add .

# Generate and commit with LLM
gac

# Review → y (commit) | n (cancel) | r (reroll)
Command Description
gac Generate commit message
gac -y Auto-confirm (no review needed)
gac -a Stage all before generating commit message
gac -o One-line message for trivial changes
gac -v Verbose format with Motivation, Technical Approach, and Impact Analysis
gac -h "hint" Add context for LLM (e.g., gac -h "bug fix")
gac -s Include scope (e.g., feat(auth):)
gac -p Commit and push
# Complete workflow in one command
gac -ayp -h "release preparation"

# Detailed explanation with scope
gac -v -s

# Quick one-liner for small changes
gac -o

# Debug what the LLM sees
gac --show-prompt

# Skip security scan (use carefully)
gac --skip-secret-scan

Interactive Reroll System

Not happy with the result? Use the reroll feature for intelligent regeneration:

# Simple reroll
r

# With specific feedback
r make it shorter and focus on the performance improvement
r use conventional commit format with scope
r explain the security implications

Run gac init to configure your provider interactively, or set environment variables:

# Example configuration
GAC_MODEL=anthropic:your-model-name
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here

See .gac.env.example for all available options.



联系我们 contact @ memedata.com