commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConventional Commits
Conventional Commits
Overview
概述
The commit skill summarizes the Conventional Commits 1.0.0 specification and
common best practices, supporting compliant commit messages. Reference:
Conventional Commits 1.0.0.
本技能总结了Conventional Commits 1.0.0规范及通用最佳实践,助力编写合规的提交信息。参考链接:Conventional Commits 1.0.0。
Commit Format
提交格式
text
<type>[optional scope][!]: <description>
[optional body]
[optional footer(s)]Elements:
- type (required): Primary intent of the change. and
featmap to semantic versioning. Additional allowed types include:fix,docs,style,refactor,perf,test,build,ci,chore.revert - scope (optional): Short component or package name in parentheses, e.g.,
.
feat(parser): ... - ! (optional): Indicates a breaking change and can appear after type or scope.
- description (required): Short, imperative summary in lower case (no trailing period). Aim for ≤ 72 characters.
- body (optional): Explain what/why; wrap at ~72 characters.
- footers (optional): Git trailer format, e.g., ,
BREAKING CHANGE: ...,Refs: #123.Closes: #123
text
<type>[optional scope][!]: <description>
[optional body]
[optional footer(s)]组成元素:
- type(必填):变更的主要目的。和
feat对应语义化版本控制。其他允许的类型包括:fix、docs、style、refactor、perf、test、build、ci、chore。revert - scope(可选):括号内的简短组件或包名称,例如:。
feat(parser): ... - !(可选):表示破坏性变更,可出现在type或scope之后。
- description(必填):简短的祈使语气总结,小写(无结尾句号)。目标长度≤72字符。
- body(可选):解释变更内容及原因;每行约72字符换行。
- footers(可选):Git trailer格式,例如:、
BREAKING CHANGE: ...、Refs: #123。Closes: #123
Workflow
工作流程
- Review changes and identify the primary intent (feature, fix, docs, etc.).
- Choose the and optional
type. If changes span multiple intents, prefer separate commits; otherwise pick the highest-impact type.scope - Determine whether the change is breaking. If yes, add and/or a
!footer.BREAKING CHANGE: - Write a concise description in imperative mood.
- Add body and footers as needed for context, rationale, or issue links.
- Validate against the checklist below.
- 查看变更内容,确定主要目的(功能、修复、文档等)。
- 选择及可选的
type。若变更涉及多个目的,优先拆分为多个提交;否则选择影响最大的类型。scope - 判断变更是否为破坏性变更。若是,添加和/或
!footer。BREAKING CHANGE: - 用祈使语气编写简洁的描述。
- 按需添加body和footer以提供上下文、理由或关联issue链接。
- 根据下方清单验证提交信息。
Checklist
检查清单
- Header matches format.
<type>(<scope>): <description> - Type is correct for the change (/
featfor user-facing behavior).fix - Description is imperative, ≤ 72 chars, and has no trailing period.
- Breaking changes are marked with and/or
!.BREAKING CHANGE: - Footers follow format.
Token: value
- 标题符合格式。
<type>(<scope>): <description> - Type与变更类型匹配(面向用户的行为变更使用/
feat)。fix - 描述为祈使语气,长度≤72字符,无结尾句号。
- 破坏性变更已用和/或
!标记。BREAKING CHANGE: - Footers遵循格式。
Token: value
Examples
示例
feat(auth): add refresh token rotationfix(api): handle empty payloadsdocs: add migration guiderefactor(ui): extract button variantsperf(db): batch writes to reduce roundtripschore(deps): bump eslint to 9.0.0
Breaking change:
text
feat(api)!: drop deprecated v1 endpoints
BREAKING CHANGE: v1 endpoints were removed. Use /v2 instead.Revert:
text
revert: feat(auth): add refresh token rotation
This reverts commit 1234abcd.feat(auth): add refresh token rotationfix(api): handle empty payloadsdocs: add migration guiderefactor(ui): extract button variantsperf(db): batch writes to reduce roundtripschore(deps): bump eslint to 9.0.0
破坏性变更:
text
feat(api)!: drop deprecated v1 endpoints
BREAKING CHANGE: v1 endpoints were removed. Use /v2 instead.撤销提交:
text
revert: feat(auth): add refresh token rotation
This reverts commit 1234abcd.Tips
小贴士
- Use scopes for packages or subsystems (e.g., ,
api,ui).cli - Avoid mixing unrelated changes in a single commit.
- Use or
stylefor formatting-only changes.chore - Use or
cifor pipeline and dependency changes.build - Use for changes limited to tests.
test
- 针对包或子系统使用scope(例如:、
api、ui)。cli - 避免在单个提交中混合无关变更。
- 仅涉及格式调整的变更使用或
style。chore - 流水线和依赖变更使用或
ci。build - 仅涉及测试的变更使用。
test