commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
You are making a git commit for this project. Follow these steps carefully.
你正在为该项目执行git commit操作,请仔细遵循以下步骤。

Setup

准备工作

This skill includes a
commit-msg
git hook that enforces CHANGELOG.md updates on
feat:
and
fix:
commits. Run the setup script from the project root to check status and get install instructions:
bash
scripts/setup.sh
该技能包含一个
commit-msg
git钩子,用于强制要求
feat:
和
fix:
类型的提交必须更新CHANGELOG.md。从项目根目录运行设置脚本以检查状态并获取安装说明:
bash
scripts/setup.sh

1. Review changes

1. 查看更改

Run
git status
and
git diff
to understand what has changed.
运行
git status
和
git diff
以了解具体更改内容。

2. Update CHANGELOG.md

2. 更新CHANGELOG.md

The commit hook requires
CHANGELOG.md
to be staged for any
feat:
or
fix:
commit. Add a concise entry under
## [Unreleased]
describing the changes.
Skip this requirement by using an exempt prefix (see below) — but only when genuinely appropriate.
对于任何
feat:
或
fix:
类型的提交,git钩子要求必须将CHANGELOG.md纳入暂存。在
## [Unreleased]
下方添加一条简洁的条目描述更改内容。
仅在确实合适的情况下,可通过使用豁免前缀跳过此要求(见下文)。

3. Write the commit message

3. 编写提交信息

Use the Conventional Commits format:
<type>(<optional scope>): <short description>

<optional body>

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
使用Conventional Commits格式:
<类型>(<可选范围>): <简短描述>

<可选正文>

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Types

类型说明

TypeWhen to useRequires CHANGELOG?
feat:
New feature or user-visible changeYes
fix:
Bug fixYes
chore:
Maintenance, deps, config, toolingNo
docs:
Documentation onlyNo
style:
Formatting, whitespaceNo
test:
Tests onlyNo
ci:
CI/CD changesNo
build:
Build system changesNo
revert:
Reverting a commitNo
类型使用场景是否需要更新CHANGELOG?
feat:
新功能或用户可见的变更是
fix:
Bug修复是
chore:
维护工作、依赖更新、配置调整、工具变更否
docs:
仅文档变更否
style:
格式调整、空白字符修改否
test:
仅测试相关变更否
ci:
CI/CD流程变更否
build:
构建系统变更否
revert:
撤销提交否

Message rules

信息规则

  • Subject line: imperative mood, ≤72 chars, no period
  • Be specific: describe what and why, not just what
  • Use body for additional context if needed
  • 主题行:使用祈使语气,长度≤72字符,末尾不加句号
  • 内容具体:描述做了什么和为什么做,而不只是做了什么
  • 如需额外上下文,可在正文中补充

4. Stage and commit

4. 暂存并提交

  • Stage relevant files explicitly (avoid
    git add -A
    or
    git add .
    unless all changes should be included)
  • Always include
    CHANGELOG.md
    in the staged files for
    feat:
    /
    fix:
    commits
  • Pass the commit message via heredoc to preserve formatting:
bash
git commit -m "$(cat <<'EOF'
feat: short description

Longer explanation if needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
EOF
)"
  • 明确暂存相关文件(除非所有变更都需要纳入,否则避免使用
    git add -A
    或
    git add .
    )
  • 对于
    feat:
    /
    fix:
    类型的提交,务必将CHANGELOG.md纳入暂存文件
  • 通过here-doc传递提交信息以保留格式:
bash
git commit -m "$(cat <<'EOF'
feat: short description

Longer explanation if needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
EOF
)"

5. Verify

5. 验证

Run
git status
after committing to confirm success.
提交完成后运行
git status
以确认操作成功。