vcs-commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVCS Commit
VCS 提交规范
Conventional Commit Format
Conventional Commit 格式
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]<type>[可选范围]: <描述>
[可选正文]
[可选页脚]Types
类型
- : New feature
feat - : Bug fix
fix - : Documentation
docs - : Formatting
style - : Refactor
refactor - : Tests
test - : Performance
perf - : Maintenance
chore
- : 新功能
feat - : 修复Bug
fix - : 文档更新
docs - : 格式调整(不影响代码逻辑)
style - : 代码重构
refactor - : 测试相关
test - : 性能优化
perf - : 日常维护
chore
Breaking Changes
破坏性变更
undefinedundefinedExclamation mark after type/scope
类型/范围后加感叹号
feat!: remove deprecated endpoint
feat!: 移除已废弃的接口
BREAKING CHANGE footer
BREAKING CHANGE 页脚
feat: allow config to extend other configs
BREAKING CHANGE: key behavior changed
extendsundefinedfeat: 允许配置继承其他配置
BREAKING CHANGE: 字段的行为已变更
extendsundefinedWorkflow
工作流程
- Stage: (Group changes logically).
git add <files> - Analyze: Use to understand changes.
git diff --staged - Drafting:
- Write in English only.
- Follow Conventional Commits.
- Use imperative mood ("add" not "added").
- MITM Confirmation: ALWAYS present the drafted commit message to the USER for approval before executing .
git commit - Commit:
git commit -m "<type>(scope): <description>"
- 暂存:(按逻辑分组变更)。
git add <files> - 分析:使用查看变更内容。
git diff --staged - 撰写提交信息:
- 仅使用英文撰写。
- 遵循Conventional Commits规范。
- 使用祈使语气(如用“add”而非“added”)。
- 确认环节:在执行前,务必将撰写好的提交信息提交给用户确认。
git commit - 提交:
git commit -m "<type>(scope): <description>"
Best Practices
最佳实践
- One logical change per commit
- Present tense: "add" not "added"
- Imperative mood: "fix bug" not "fixes bug"
- Reference issues: ,
Closes #123Refs #456 - Keep description under 72 characters
- 每次提交对应一个逻辑变更
- 使用现在时:“add”而非“added”
- 使用祈使语气:“fix bug”而非“fixes bug”
- 关联问题:、
Closes #123Refs #456 - 描述部分控制在72字符以内
Git Safety Protocol
Git 安全规范
- No Secrets: Never commit API keys or credentials.
- NEVER run destructive commands (--force, hard reset) without explicit request
- NEVER skip hooks (--no-verify) unless user asks
- NEVER force push to main/master
- If commit fails due to hooks, fix and create NEW commit (don't amend)
- 禁止提交敏感信息:绝不要提交API密钥或凭证。
- 未经明确请求,绝不执行破坏性命令(如--force、硬重置)
- 除非用户要求,绝不跳过钩子(--no-verify)
- 绝不强制推送到main/master分支
- 若因钩子导致提交失败,修复后创建新提交(不要修改已有提交)