commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYou are making a git commit for this project. Follow these steps carefully.
你正在为该项目执行git commit操作,请仔细遵循以下步骤。
Setup
准备工作
This skill includes a git hook that enforces CHANGELOG.md updates on and commits. Run the setup script from the project root to check status and get install instructions:
commit-msgfeat:fix:bash
scripts/setup.sh该技能包含一个 git钩子,用于强制要求和类型的提交必须更新CHANGELOG.md。从项目根目录运行设置脚本以检查状态并获取安装说明:
commit-msgfeat:fix:bash
scripts/setup.sh1. Review changes
1. 查看更改
Run and to understand what has changed.
git statusgit diff运行和以了解具体更改内容。
git statusgit diff2. Update CHANGELOG.md
2. 更新CHANGELOG.md
The commit hook requires to be staged for any or commit. Add a concise entry under describing the changes.
CHANGELOG.mdfeat:fix:## [Unreleased]Skip this requirement by using an exempt prefix (see below) — but only when genuinely appropriate.
对于任何或类型的提交,git钩子要求必须将CHANGELOG.md纳入暂存。在下方添加一条简洁的条目描述更改内容。
feat:fix:## [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
类型说明
| Type | When to use | Requires CHANGELOG? |
|---|---|---|
| New feature or user-visible change | Yes |
| Bug fix | Yes |
| Maintenance, deps, config, tooling | No |
| Documentation only | No |
| Formatting, whitespace | No |
| Tests only | No |
| CI/CD changes | No |
| Build system changes | No |
| Reverting a commit | No |
| 类型 | 使用场景 | 是否需要更新CHANGELOG? |
|---|---|---|
| 新功能或用户可见的变更 | 是 |
| Bug修复 | 是 |
| 维护工作、依赖更新、配置调整、工具变更 | 否 |
| 仅文档变更 | 否 |
| 格式调整、空白字符修改 | 否 |
| 仅测试相关变更 | 否 |
| CI/CD流程变更 | 否 |
| 构建系统变更 | 否 |
| 撤销提交 | 否 |
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 or
git add -Aunless all changes should be included)git add . - Always include in the staged files for
CHANGELOG.md/feat:commitsfix: - 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:类型的提交,务必将CHANGELOG.md纳入暂存文件fix: - 通过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 after committing to confirm success.
git status提交完成后运行以确认操作成功。
git status