commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWrite every commit in Conventional Commits format: , then an optional body and footer.
<type>(scope): <description>所有提交均需采用 Conventional Commits 格式:,之后可选择性添加正文和页脚。
<type>(scope): <description>Steps
步骤
- Read the diff. Run and
git status(fall back togit diff --stagedwhen nothing is staged).git diff - Classify. Choose the (
type,feat,fix,docs,style,refactor,perf,test,build,ci,chore), therevert(the affected area, omitted when the change is broad), and ascope— one imperative-mood line under 72 characters. Each of the three must trace to a specific change in the diff. If the diff holds more than one unrelated change, commit them separately.description - Compose. Assemble the subject line. Add a body — the why, and what a reader can't see from the diff — when the change isn't self-evident, and a footer (,
Closes: <id>) when an issue applies. Signal a breaking change withRefs: <id>(!), or afeat(api)!: require verified emailfooter when the break needs explaining.BREAKING CHANGE: - Commit. Stage the intended files — if they contain secrets or credentials, stop and flag it instead. Run and let hooks run; if one fails, fix the cause or report it.
git commit
Rewriting shared history or bypassing checks — , , , edits — happens only when the user explicitly asks.
--forcereset --hard--no-verifygit config- 查看diff。 运行 和
git status(若无暂存内容,则改用git diff --staged)。git diff - 分类。 选择 (可选值:
type、feat、fix、docs、style、refactor、perf、test、build、ci、chore)、revert(受影响范围,若变更涉及面广则省略)以及scope——一行祈使句,长度不超过72个字符。这三部分都必须对应diff中的具体变更。如果diff包含多个不相关的变更,需分开提交。description - 撰写。 组装主题行。当变更不言自明时无需添加额外内容,否则补充正文——说明变更的_原因_,以及读者从diff中无法得知的信息;如果关联了issue,添加页脚(、
Closes: <id>)。使用Refs: <id>标记破坏性变更(示例:!),如果破坏性变更需要详细说明,添加feat(api)!: require verified email页脚。BREAKING CHANGE: - 提交。 暂存目标文件——如果文件包含密钥或凭证,立即停止并标记问题。运行 并让钩子正常执行;若有钩子执行失败,修复原因或上报。
git commit
重写共享历史或绕过检查的操作——包括 、、、修改 ——仅在用户明确要求时执行。
--forcereset --hard--no-verifygit config