commit · git:20260904.3fbd6a2 · 2026-09-04 · sha256 9a0a335072e6c758

commit git:20260904.3fbd6a2A

Immutable. This exact content is served forever at /api/v1/blob/9a0a335072e6c758.

---
name: commit
description: 查看 git 改动并生成 commit message 提交
when_to_use: 用户要求提交代码、写 commit message 时
allowed_tools:
  - Bash
  - read_file
---

# 提交代码

按以下步骤执行:

1. `git status` + `git diff`(含 `--stat`)了解全部改动,不要只看单个文件
2. 判断改动意图,归纳成一个 commit;若改动包含多个不相关主题,向用户建议拆分
3. 写 commit message:
   - 格式:`type: 简述(中文)`;type 从 feat/fix/refactor/test/docs/chore 里选
   - 首行 ≤50 字符,正文(可省略)说明 why,不重复 diff 能看到的 what
4. 提交前把 message 给用户过目确认,再执行 `git add`(只加相关文件,不要无脑 `-A`)+ `git commit`
5. 不要 push,除非用户明确要求