vcs-commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

VCS Commit

VCS 提交规范

Conventional Commit Format

Conventional Commit 格式

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
<type>[可选范围]: <描述>

[可选正文]

[可选页脚]

Types

类型

  • feat
    : New feature
  • fix
    : Bug fix
  • docs
    : Documentation
  • style
    : Formatting
  • refactor
    : Refactor
  • test
    : Tests
  • perf
    : Performance
  • chore
    : Maintenance
  • feat
    : 新功能
  • fix
    : 修复Bug
  • docs
    : 文档更新
  • style
    : 格式调整(不影响代码逻辑)
  • refactor
    : 代码重构
  • test
    : 测试相关
  • perf
    : 性能优化
  • chore
    : 日常维护

Breaking Changes

破坏性变更

undefined
undefined

Exclamation mark after type/scope

类型/范围后加感叹号

feat!: remove deprecated endpoint
feat!: 移除已废弃的接口

BREAKING CHANGE footer

BREAKING CHANGE 页脚

feat: allow config to extend other configs
BREAKING CHANGE:
extends
key behavior changed
undefined
feat: 允许配置继承其他配置
BREAKING CHANGE:
extends
字段的行为已变更
undefined

Workflow

工作流程

  1. Stage:
    git add <files>
    (Group changes logically).
  2. Analyze: Use
    git diff --staged
    to understand changes.
  3. Drafting:
    • Write in English only.
    • Follow Conventional Commits.
    • Use imperative mood ("add" not "added").
  4. MITM Confirmation: ALWAYS present the drafted commit message to the USER for approval before executing
    git commit
    .
  5. Commit:
    git commit -m "<type>(scope): <description>"
  1. 暂存
    git add <files>
    (按逻辑分组变更)。
  2. 分析:使用
    git diff --staged
    查看变更内容。
  3. 撰写提交信息
    • 仅使用英文撰写。
    • 遵循Conventional Commits规范。
    • 使用祈使语气(如用“add”而非“added”)。
  4. 确认环节:在执行
    git commit
    前,务必将撰写好的提交信息提交给用户确认。
  5. 提交
    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 #123
    ,
    Refs #456
  • Keep description under 72 characters
  • 每次提交对应一个逻辑变更
  • 使用现在时:“add”而非“added”
  • 使用祈使语气:“fix bug”而非“fixes bug”
  • 关联问题:
    Closes #123
    Refs #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分支
  • 若因钩子导致提交失败,修复后创建新提交(不要修改已有提交)