---
title: GAC：让 AI 理解代码上下文，自动生成 Git 提交信息，高质量、好格式
date: 2025-11-02T09:38:52Z
modified: 2025-11-02T09:40:26Z
permalink: "https://www.appinn.com/git-auto-commit/"
type: post
status: publish
excerpt: ""
categories:
  - linux
  - AI
  - macOS
  - Windows
tags:
  - linux
  - AI
  - macOS
  - Windows
  - Git
  - 开发者工具
featured_image: "https://www.appinn.com/wp-content/uploads/2025/11/Copy-of-appinn-homework-2025-11-02T171512.067.jpg"
author: 青小蛙
timestamp: 2025-11-02T09:40:26Z
---

写代码顺手，但写提交信息总让人头疼。有时只是改了几行代码，却要绞尽脑汁想一句“像样”的 commit 信息，最后往往草草一句 “update” 了事。@[Appinn](https://www.appinn.com/git-auto-commit.md)

**GAC**，全称 Git Auto Commit，就是为了解决这个小痛点。它能让 AI 理解你修改的上下文，生成一段语义清晰、结构规范、甚至能解释“为什么改”的提交说明，减轻你的工作量。

更妙的是，整个过程只需一条命令，几乎不打断你的开发思路。

![](https://www.appinn.com/wp-content/uploads/2025/11/Copy-of-appinn-homework-2025-11-02T171512.067.jpg)

什么？现在谁还手写代码？不都是 AI 写的么？

## 🚀 Git Auto Commit (gac)

**GAC** 的使用非常简单，只需要用 gac 替换 git commit -m “…” 就行了。

它就回调用大语言模型，根据上下文代码，生成格式漂亮的提交信息。

### 安装


uv tool install gac
gac init
gac


### 一个例子：

![](https://www.appinn.com/wp-content/uploads/2025/11/gac-simple-usage-2.avif)

gac 只替代了 git commit 这条命令，在上面这个例子中，你需要：


# 1. 暂存改动
git add .
# 2. 用 GAC 自动生成提交信息并提交
gac -s
# 这一步会调用 LLM（比如 OpenAI、Anthropic、Groq 等）来分析改动，
# 然后生成 commit message，并在你确认后执行 git commit。
# 3. 推送到远程仓库
git push


就可以了。

### **支持中文**

运行 **`gac language`** 就可以选择提交语言了。

## 支持的大语言模型

- **Anthropic** • **Cerebras** • **Chutes.ai** • **DeepSeek** • **Fireworks**
- **Gemini** • **Groq** • **LM Studio** • **MiniMax** • **Mistral** • **Ollama** • **OpenAI**
- **OpenRouter** • **Streamlake** • **Synthetic.new** • **Together AI**
- **Z.AI** • **Z.AI Coding** • **Custom Endpoints (Anthropic/OpenAI)**

是的，主流都支持。

## 获取

- [GitHub](https://github.com/cellwebb/gac)

更多的，就靠各位开发者自行研究了。

---

原文：https://www.appinn.com/git-auto-commit/

## Topics

**分类目录:** [linux](https://www.appinn.com/category/linux/?output_format=md), [AI](https://www.appinn.com/category/ai/?output_format=md), [macOS](https://www.appinn.com/category/mac/?output_format=md), [Windows](https://www.appinn.com/category/windows/?output_format=md)

**标签:** [Git](https://www.appinn.com/tag/git/?output_format=md), [开发者工具](https://www.appinn.com/tag/%e5%bc%80%e5%8f%91%e8%80%85%e5%b7%a5%e5%85%b7/?output_format=md)