conventional-commits
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConventional Commits
Conventional Commits
Structured commit message format for version control that provides clear, readable project history.
一种用于版本控制的结构化提交消息格式,可提供清晰、易读的项目历史。
Overview
概述
The Conventional Commits specification provides:
- Automated changelog generation - Tools can parse commits to generate CHANGELOG.md
- Semantic versioning - Commit types map to version bumps (feat → minor, breaking → major)
- Clear project history - Standardized format makes git log readable
- Automated releases - CI/CD can trigger releases based on commit types
Conventional Commits规范提供以下功能:
- 自动生成变更日志 - 工具可解析提交内容来生成CHANGELOG.md
- 语义化版本控制 - 提交类型对应版本更新(feat → 次版本号,破坏性变更 → 主版本号)
- 清晰的项目历史 - 标准化格式让git log更易读
- 自动化发布 - CI/CD可根据提交类型触发发布
Quick Reference
快速参考
| Type | Use For | Version Bump |
|---|---|---|
| New feature | MINOR |
| Bug fix | PATCH |
| Documentation only | PATCH |
| Formatting, no logic change | PATCH |
| Code restructuring, no behavior change | PATCH |
| Performance improvement | PATCH |
| Adding or updating tests | PATCH |
| Build system or dependencies | PATCH |
| CI/CD configuration | PATCH |
| Maintenance, no user-facing change | PATCH |
| Revert a previous commit | PATCH |
| 类型 | 适用场景 | 版本更新 |
|---|---|---|
| 新功能 | MINOR |
| Bug修复 | PATCH |
| 仅文档更新 | PATCH |
| 代码格式化,无逻辑变更 | PATCH |
| 代码重构,无行为变更 | PATCH |
| 性能优化 | PATCH |
| 添加或更新测试 | PATCH |
| 构建系统或依赖更新 | PATCH |
| CI/CD配置变更 | PATCH |
| 维护工作,无用户可见变更 | PATCH |
| 回滚之前的提交 | PATCH |
Format
格式
text
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]Rules:
- Type is required
- Scope is optional - use parenthesized section affected: ,
(api),auth)parser) - Description is required
- Keep description concise, imperative mood, lowercase, no trailing period
- Body and footer are optional
- Separate subject from body with blank line
- Wrap body at 72 characters
text
<type>[可选范围]: <描述>
[可选正文]
[可选页脚]规则:
- 类型为必填项
- 范围为可选项 - 使用括号标注受影响的模块:、
(api)、(auth)(parser) - 描述为必填项
- 描述需简洁、使用祈使语气、小写、结尾无句号
- 正文和页脚为可选项
- 主题与正文之间用空行分隔
- 正文每行不超过72个字符
Examples
示例
text
feat: add user authentication
Implement JWT-based authentication with login/logout endpoints.
Includes password hashing and session management.
Closes: #123text
fix(api): handle null response from server
Previous implementation crashed when server returned null.
Now returns empty result set.
Assisted-by: GLM 4.6 via Claude Codetext
feat(storage)!: change bucket listing API
BREAKING CHANGE: bucket list now returns async iterator
instead of array. Update all callers to use for-await.text
refactor(core): simplify error handling
Consolidate duplicate error handlers into single utility.
No behavior changes - internal cleanup only.text
revert: feat(auth): add OAuth support
This reverts commit 8b5a1c2. OAuth provider changed
their API and we need to redesign integration.text
feat: add user authentication
Implement JWT-based authentication with login/logout endpoints.
Includes password hashing and session management.
Closes: #123text
fix(api): handle null response from server
Previous implementation crashed when server returned null.
Now returns empty result set.
Assisted-by: GLM 4.6 via Claude Codetext
feat(storage)!: change bucket listing API
BREAKING CHANGE: bucket list now returns async iterator
instead of array. Update all callers to use for-await.text
refactor(core): simplify error handling
Consolidate duplicate error handlers into single utility.
No behavior changes - internal cleanup only.text
revert: feat(auth): add OAuth support
This reverts commit 8b5a1c2. OAuth provider changed
their API and we need to redesign integration.Breaking Changes
破坏性变更
Indicate breaking changes in two ways:
Option 1: Add after type/scope
!text
feat(api)!: remove deprecated endpointOption 2: Add footer
BREAKING CHANGE:text
feat(api): remove deprecated endpoint
BREAKING CHANGE: endpoint no longer exists. Use newEndpoint instead.有两种方式标记破坏性变更:
方式1: 在类型/范围后添加
!text
feat(api)!: remove deprecated endpoint方式2: 添加页脚
BREAKING CHANGE:text
feat(api): remove deprecated endpoint
BREAKING CHANGE: endpoint no longer exists. Use newEndpoint instead.AI Attribution
AI贡献声明
AI agents must disclose their assistance in the commit footer:
text
Assisted-by: [Model Name] via [Tool Name]Examples:
Assisted-by: GLM 4.6 via Claude CodeAssisted-by: Claude Opus 4.5 via claude.ai
AI Agent必须在提交页脚中披露其协助:
text
Assisted-by: [Model Name] via [Tool Name]示例:
Assisted-by: GLM 4.6 via Claude CodeAssisted-by: Claude Opus 4.5 via claude.ai
Common Mistakes
常见错误
| Mistake | Why Wrong | Correct |
|---|---|---|
| Past tense, capitalized | |
| Trailing period | |
| Missing type | |
| Missing space after colon | |
| Uppercase type | |
| Multi-line description no blank line | No separation | Add blank line after subject |
| 错误示例 | 错误原因 | 正确示例 |
|---|---|---|
| 过去式、首字母大写 | |
| 结尾有句号 | |
| 缺少类型 | |
| 冒号后缺少空格 | |
| 类型为大写 | |
| 多行描述无空行分隔 | 主题与正文未分离 | 在主题后添加空行 |
Body Guidelines
正文撰写指南
- What: Motivation for the change (vs. code comments describe HOW)
- Contrast: Explain the WHY and WHAT, not code details
- Wrap at 72 characters for readability in git log
text
feat(summarization): add support for nested bullet points
Previous implementation only flattened all content. Now preserves
hierarchy by respecting indentation levels. Users can now create
structured summaries with parent-child relationships.
Closes: #456- 内容: 变更的动机(代码注释描述的是实现方式,此处需说明原因)
- 重点: 解释原因和变更内容,而非代码细节
- 每行不超过72个字符,以保证在git log中可读性良好
text
feat(summarization): add support for nested bullet points
Previous implementation only flattened all content. Now preserves
hierarchy by respecting indentation levels. Users can now create
structured summaries with parent-child relationships.
Closes: #456Footer Guidelines
页脚撰写指南
Use footers for:
- Breaking changes:
BREAKING CHANGE: detailed explanation - Issue references: ,
Closes: #123,Fixes: #456Refs: #789 - AI attribution:
Assisted-by: Model via Tool
Multiple footers separated by blank lines:
text
feat: add batch upload
Implements multipart upload for large files.
BREAKING CHANGE: upload() signature changed - now requires options object
Closes: #123
Assisted-by: GLM 4.6 via Claude Code页脚可用于以下场景:
- 破坏性变更:
BREAKING CHANGE: detailed explanation - 关联议题: ,
Closes: #123,Fixes: #456Refs: #789 - AI贡献声明:
Assisted-by: Model via Tool
多个页脚用空行分隔:
text
feat: add batch upload
Implements multipart upload for large files.
BREAKING CHANGE: upload() signature changed - now requires options object
Closes: #123
Assisted-by: GLM 4.6 via Claude CodeGit Commit Flags
Git提交标记
Required flag: Always use when committing:
--signoffbash
git commit --signoff -m "feat: add user authentication"The flag adds a trailer to the commit message, indicating the committer has certified the commit follows developer certificate of origin (DCO).
--signoffSigned-off-by必填标记: 提交时始终使用:
--signoffbash
git commit --signoff -m "feat: add user authentication"--signoffSigned-off-byTesting Your Commit
提交验证
Before committing, verify:
- Type is from allowed list
- Description is imperative mood (add, fix, update)
- Description is lowercase
- No trailing period on description
- Breaking changes marked with or footer
! - AI attribution included (if applicable)
- Body explains WHY not HOW
- Using flag
--signoff
提交前,请验证以下项:
- 类型属于允许的列表
- 描述使用祈使语气(add、fix、update等)
- 描述为小写
- 描述结尾无句号
- 破坏性变更已用或页脚标记
! - 已包含AI贡献声明(如适用)
- 正文解释了原因而非实现方式
- 使用了标记
--signoff