Loading...
Loading...
Compare original and translation side by side
git diff --cached --stat
git diff --cachedgit diff --cached --stat
git diff --cached| Type | When to Use | Version Bump | Example |
|---|---|---|---|
| New feature for the user | MINOR | |
| Bug fix for the user | PATCH | |
| Documentation only changes | None | |
| Formatting, missing semicolons, etc. | None | |
| Code change with no behavior change | None | |
| Performance improvement | PATCH | |
| Adding or correcting tests | None | |
| Maintenance, deps, tooling | None | |
| CI/CD configuration changes | None | |
| Build system or external dependencies | None | |
| 类型 | 使用场景 | 版本号升级 | 示例 |
|---|---|---|---|
| 面向用户的新增功能 | MINOR | |
| 面向用户的漏洞修复 | PATCH | |
| 仅文档相关更改 | 无 | |
| 格式调整、缺少分号等 | 无 | |
| 不改变行为的代码变更 | 无 | |
| 性能优化 | PATCH | |
| 新增或修正测试 | 无 | |
| 维护、依赖更新、工具调整 | 无 | |
| CI/CD配置变更 | 无 | |
| 构建系统或外部依赖变更 | 无 | |
<type>(<scope>): <description>
[optional body]
[optional footer(s)]<type>(<scope>): <description>
[可选正文]
[可选脚注]| Scope Strategy | Examples | When to Use |
|---|---|---|
| By module | | Feature-organized codebases |
| By layer | | Layer-organized codebases |
| By package | | Monorepos |
| General | | Cross-cutting changes |
| 范围策略 | 示例 | 适用场景 |
|---|---|---|
| 按模块划分 | | 按功能组织的代码库 |
| 按层级划分 | | 按层级组织的代码库 |
| 按包划分 | | Monorepo场景 |
| 通用分类 | | 跨模块更改 |
feat(cart): add quantity update functionality
Users can now change item quantities directly in the cart
without removing and re-adding items. The quantity selector
supports values from 1 to 99 with real-time price updates.
Closes #234feat(cart): add quantity update functionality
Users can now change item quantities directly in the cart
without removing and re-adding items. The quantity selector
supports values from 1 to 99 with real-time price updates.
Closes #234feat(api)!: change user endpoint response format
BREAKING CHANGE: The /api/users endpoint now returns a paginated
response object instead of a plain array. Clients must update
to read from the `data` field.
Migration guide:
- Before: const users = await fetch('/api/users').json()
- After: const { data: users } = await fetch('/api/users').json()!feat(api)!: descriptionBREAKING CHANGE:feat(api)!: change user endpoint response format
BREAKING CHANGE: The /api/users endpoint now returns a paginated
response object instead of a plain array. Clients must update
to read from the `data` field.
Migration guide:
- Before: const users = await fetch('/api/users').json()
- After: const { data: users } = await fetch('/api/users').json()!feat(api)!: descriptionBREAKING CHANGE:| Component | Increment When | Example |
|---|---|---|
| MAJOR | Breaking changes (incompatible API changes) | 1.0.0 -> 2.0.0 |
| MINOR | New features (backward compatible) | 1.0.0 -> 1.1.0 |
| PATCH | Bug fixes (backward compatible) | 1.0.0 -> 1.0.1 |
| 组成部分 | 升级触发条件 | 示例 |
|---|---|---|
| MAJOR | 破坏性更改(不兼容的API变更) | 1.0.0 -> 2.0.0 |
| MINOR | 新增功能(向后兼容) | 1.0.0 -> 1.1.0 |
| PATCH | 漏洞修复(向后兼容) | 1.0.0 -> 1.0.1 |
Commits since last release:
fix(auth): handle expired tokens -> PATCH
feat(search): add fuzzy matching -> MINOR (overrides PATCH)
fix(ui): correct button alignment -> already MINOR
feat(api)!: change response format -> MAJOR (overrides MINOR)
Result: MAJOR bump (highest wins)Commits since last release:
fix(auth): handle expired tokens -> PATCH
feat(search): add fuzzy matching -> MINOR (覆盖PATCH升级)
fix(ui): correct button alignment -> 已为MINOR升级
feat(api)!: change response format -> MAJOR (覆盖MINOR升级)
Result: MAJOR bump (最高优先级生效)1.0.0-alpha.1 -> Early testing
1.0.0-beta.1 -> Feature complete, testing
1.0.0-rc.1 -> Release candidate
1.0.0 -> Stable release1.0.0-alpha.1 -> 早期测试版本
1.0.0-beta.1 -> 功能完备,测试阶段
1.0.0-rc.1 -> 发布候选版本
1.0.0 -> 稳定版本undefinedundefinedundefinedundefined| Commit Type | Changelog Section |
|---|---|
| Added |
| Fixed |
| Performance |
| Changed |
| Documentation |
| Breaking Changes (top of release) |
| Typically excluded |
| 提交类型 | 变更日志章节 |
|---|---|
| 新增 |
| 修复 |
| 性能优化 |
| 变更 |
| 文档 |
| 破坏性更改(版本章节顶部) |
| 通常不纳入 |
| Tool | Use Case |
|---|---|
| Generate changelog from git history |
| Fully automated versioning + publishing |
| Manual changeset files for monorepos |
| Google's release automation |
| 工具 | 使用场景 |
|---|---|
| 从Git历史生成变更日志 |
| 全自动化版本管理+发布 |
| Monorepo场景的手动变更记录文件管理 |
| Google出品的发布自动化工具 |
type(scope): descriptiontype(scope): descriptionCloses #123Refs #456Closes #123Refs #456| Condition | Action |
|---|---|
| Changes to different modules/features | Split into separate commits |
| Refactor combined with feature addition | Split: refactor first, then feature |
| Test additions for existing code + new feature | Split: tests first, then feature |
| Config changes + code changes | Split into separate commits |
| Single logical change across multiple files | Keep as one commit |
| 条件 | 操作 |
|---|---|
| 更改涉及不同模块/功能 | 拆分为独立提交 |
| 重构与功能新增混合 | 拆分:先提交重构,再提交功能 |
| 为现有代码新增测试 + 新增功能 | 拆分:先提交测试,再提交功能 |
| 配置更改 + 代码更改 | 拆分为独立提交 |
| 跨多个文件的单逻辑更改 | 保留为单个提交 |
undefinedundefinedundefinedundefined| Anti-Pattern | Why It Is Wrong | What to Do Instead |
|---|---|---|
| Misleads version bump automation | Use |
| Squashing meaningful history | Loses context of development process | Keep atomic commits, squash only WIP |
Using | Bypasses quality gates | Fix the hook failure instead |
| Amending published/pushed commits | Breaks other developers' history | Create new commit instead |
| Empty or "." commit messages | Zero information for future readers | Write a descriptive message |
| Mixing formatting with logic changes | Cannot revert one without the other | Separate into distinct commits |
| "change X to Y" duplicating the diff | Adds no information beyond the diff | Describe WHY the change was made |
| Huge commits touching 20+ files | Impossible to review or bisect | Split into logical atomic commits |
| 反模式 | 错误原因 | 正确做法 |
|---|---|---|
新功能使用 | 误导版本号自动化升级 | 新功能使用 |
| 压缩有意义的提交历史 | 丢失开发过程上下文 | 保留原子提交,仅压缩WIP提交 |
使用 | 绕过质量门禁 | 修复钩子触发的错误 |
| amend已发布/推送的提交 | 破坏其他开发者的本地历史 | 新建提交替代 |
| 空提交信息或仅用「.」作为提交信息 | 对后续查看者没有任何信息价值 | 编写有描述性的提交信息 |
| 格式调整与逻辑更改混合提交 | 无法单独回滚其中一类更改 | 拆分为独立提交 |
| 「将X改为Y」这类重复diff内容的描述 | 没有提供diff之外的额外信息 | 描述更改的原因 |
| 涉及20+文件的巨型提交 | 无法评审或二分定位问题 | 拆分为逻辑独立的原子提交 |
| Skill | Integration |
|---|---|
| Squash commit message follows conventional format |
| Commit quality is part of review checklist |
| Version bumps trigger release pipelines |
| Commit scoping aligns with plan task granularity |
| Verify tests pass before committing |
| 技能 | 集成方式 |
|---|---|
| 压缩合并的提交信息遵循conventional格式 |
| 提交质量是评审检查项的一部分 |
| 版本号升级触发发布流水线 |
| 提交范围与规划任务粒度对齐 |
| 提交前验证测试通过 |