commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Commit Skill
Git 提交技巧
Create a focused, single-line commit following conventional commit conventions.
按照约定式提交规范创建聚焦的单行提交。
Instructions
操作步骤
- Analyze changes: Run and
git statusto understand what was modifiedgit diff - Stage only modified files: Add files individually by name. NEVER use or
git add -Agit add . - Write commit message: Follow the conventional commit format as a single line
- 分析更改:运行和
git status以了解修改内容git diff - 仅暂存修改的文件:按文件名逐个添加文件。绝对不要使用或
git add -Agit add . - 编写提交消息:按照约定式提交格式编写单行消息
Conventional Commit Format
约定式提交格式
<type>: <description><type>: <description>Types
类型
- : New feature or capability
feat - : Bug fix
fix - : Code change that neither fixes a bug nor adds a feature
refactor - : Documentation only changes
docs - : Formatting, missing semicolons, etc (no code change)
style - : Adding or correcting tests
test - : Maintenance tasks, dependency updates, etc
chore - : Performance improvement
perf
- : 新功能或功能增强
feat - : 修复Bug
fix - : 既不修复Bug也不添加功能的代码变更
refactor - : 仅修改文档
docs - : 格式调整(如缺少分号等,无代码逻辑变更)
style - : 添加或修正测试
test - : 维护任务、依赖更新等
chore - : 性能优化
perf
Rules
规则
- Message MUST be a single line (no multi-line messages)
- Description should be lowercase, imperative mood ("add" not "added")
- No period at the end
- Keep under 72 characters total
- 提交消息必须为单行(不允许多行消息)
- 描述部分需使用小写、祈使语气(如用“add”而非“added”)
- 结尾不得加句号
- 总长度控制在72字符以内
Examples
示例
feat: add token usage tracking for AI providers
fix: resolve null pointer in job executor
refactor: extract common validation logic
docs: update API endpoint documentation
chore: upgrade sqlx to 0.7feat: add token usage tracking for AI providers
fix: resolve null pointer in job executor
refactor: extract common validation logic
docs: update API endpoint documentation
chore: upgrade sqlx to 0.7Execution Steps
执行步骤
- Run to see all changes
git status - Run to understand the changes in detail
git diff - Run to see recent commit style
git log --oneline -5 - Stage ONLY the modified/relevant files:
git add <file1> <file2> ... - Create the commit with conventional format:
bash
git commit -m "<type>: <description> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>" - Run to verify the commit succeeded
git status
- 运行查看所有更改
git status - 运行详细了解更改内容
git diff - 运行查看近期提交风格
git log --oneline -5 - 仅暂存修改的相关文件:
git add <file1> <file2> ... - 按照约定式格式创建提交:
bash
git commit -m "<type>: <description> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>" - 运行验证提交是否成功
git status