git-commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Commit
Git 提交
Inspect
检查
- Inspect and the relevant staged/working diffs before writing anything.
git status - Detect the actual change from the diff; do not guess from open tabs or filenames only.
- Exclude files the user explicitly says not to commit or not to include in the message.
- 先检查以及相关的暂存区/工作区差异,再进行任何编写操作。
git status - 从差异中检测实际变更内容;不要仅根据打开的标签页或文件名猜测。
- 排除用户明确说明不提交或不纳入消息的文件。
Pick Command Shape
选择命令格式
- Use one line for one coherent intent, even when it touches several files.
- Use one line for focused updates such as one UI behavior change, repeated CSS cleanup, or one variable/API rename.
- Use a detailed commit for multiple independent intents, risky behavior changes, migrations, broad feature work, or context future readers need.
- 若变更为单一连贯意图,即使涉及多个文件,也使用单行格式。
- 针对聚焦型更新(如单一UI行为变更、重复的CSS清理、单一变量/API重命名)使用单行格式。
- 若包含多个独立意图、高风险行为变更、迁移工作、广泛的功能开发,或未来阅读者需要相关上下文,则使用详细提交格式。
Subject
主题
- Treat the first as the commit subject. It must summarize the whole commit.
-m - For one-line commits, use Conventional Commits: .
type(scope): concise summary - For detailed commits, use a plain-English overall subject without .
type(scope) - Keep detailed subjects readable in , for example
git log --oneline.Add passkey authentication support - Prefer imperative mood when natural.
- 将第一个参数作为提交主题,必须概括整个提交内容。
-m - 单行提交需遵循Conventional Commits规范:。
type(scope): concise summary - 详细提交的主题使用通俗易懂的英文表述,无需格式。
type(scope) - 确保详细提交的主题在中可读性良好,例如
git log --oneline。Add passkey authentication support - 自然情况下优先使用祈使语气。
Body
正文
- Add a body only when it helps explain why the change was needed and what changed.
- Use a second argument for the body.
-m - Use literal newlines for paragraphs and bullets.
- Write the body paragraph in descriptive English.
- 仅当有助于解释变更原因和变更内容时才添加正文。
- 使用第二个参数传递正文内容。
-m - 使用字面换行符分隔段落和项目符号。
- 正文段落使用描述性英文书写。
Monorepos
单仓架构(Monorepo)
- If the repo is a monorepo or the diff spans apps/packages, prefer scoped body bullets: .
type(scope): specific change - Use concrete scopes from affected apps/packages/domains, such as ,
admin,server,website, ordocs.shared - Do not use vague labels like ,
Both, orFrontendwhen concrete scopes exist.Backend - Sort scoped bullets by type, then scope, then importance.
- Prefer this type order: ,
feat,fix,refactor,perf,test,docs,style.chore
- 若仓库为monorepo或差异涉及多个应用/包,优先使用带范围的项目符号格式:。
type(scope): specific change - 使用受影响的应用/包/领域的具体范围,例如、
admin、server、website或docs。shared - 当存在具体范围时,避免使用、
Both或Frontend这类模糊标签。Backend - 按类型、范围、重要性对带范围的项目符号排序。
- 优先遵循以下类型顺序:、
feat、fix、refactor、perf、test、docs、style。chore
Single Repos
单仓库
- For single-repo detailed commits, plain body bullets are fine.
- Keep bullets specific and ordered by importance.
- 单仓库的详细提交使用普通项目符号格式即可。
- 项目符号需具体,并按重要性排序。
Guardrails
约束规则
- Return only a ready-to-run command.
git commit - Do not include a command.
git add - Do not run the commit unless explicitly asked.
- Do not add AI or agent co-author lines.
- 仅返回可直接运行的命令。
git commit - 不要包含命令。
git add - 除非明确要求,否则不要执行提交操作。
- 不要添加AI或Agent合著者行。
Templates
模板
One-line:
bash
git commit -m "type(scope): concise overall summary"Detailed monorepo:
bash
git commit -m "Plain-English overall summary" -m "Describe the problem or motivation and what the full commit changes in normal English.
- type(scope): first specific change
- type(scope): second specific change
- type(scope): third specific change"Detailed single-repo:
bash
git commit -m "Plain-English overall summary" -m "Describe the problem or motivation and what the full commit changes in normal English.
- type(scope): first specific change
- type(scope): second specific change
- type(scope): third specific change"NOTE: you must give the git commit format inside , do not give raw text. becuase output will be copied and pasted in terminal
bash {...determined git commit format}单行格式:
bash
git commit -m "type(scope): concise overall summary"详细单仓架构格式:
bash
git commit -m "Plain-English overall summary" -m "Describe the problem or motivation and what the full commit changes in normal English.
- type(scope): first specific change
- type(scope): second specific change
- type(scope): third specific change"详细单仓库格式:
bash
git commit -m "Plain-English overall summary" -m "Describe the problem or motivation and what the full commit changes in normal English.
- type(scope): first specific change
- type(scope): second specific change
- type(scope): third specific change"注意:必须将git commit格式放在中,不要返回纯文本。因为输出内容将被复制粘贴到终端中
bash {...determined git commit format}