commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit
提交
Quick start
快速开始
When user triggers or asks to commit:
/commit- Run to stage all changes
git add -A - Run and
git statusto review changesgit diff --staged - Draft a conventional commit message ()
type(scope): subject - Present summary + commit message to user
- Ask for confirmation via tool
question - If confirmed:
git commit -m "message"
当用户触发或请求提交时:
/commit- 运行暂存所有更改
git add -A - 运行和
git status查看更改git diff --staged - 起草符合规范的提交信息(格式)
type(scope): subject - 向用户展示更改摘要和提交信息
- 通过工具请求用户确认
question - 若确认:执行
git commit -m "message"
Workflow
工作流
1. Stage all changes
1. 暂存所有更改
Run to stage all modified, added, and deleted files.
git add -A运行暂存所有已修改、新增和删除的文件。
git add -A2. Review changes
2. 查看更改
Run in parallel:
git statusgit diff --staged- (for context)
git log --oneline -5
Identify:
- Modified, added, deleted files
- The nature of changes (feature, fix, refactor, docs, test, chore)
并行运行以下命令:
git statusgit diff --staged- (用于获取上下文)
git log --oneline -5
确认以下内容:
- 已修改、新增、删除的文件
- 更改的类型(功能新增、Bug修复、代码重构、文档更新、测试修改、杂项任务)
3. Draft commit message
3. 起草提交信息
Follow Conventional Commits:
- feat: new feature
- fix: bug fix
- docs: documentation changes
- style: formatting, missing semicolons, etc.
- refactor: code change that neither fixes a bug nor adds a feature
- test: adding or correcting tests
- chore: build process, dependencies, tooling
Format:
type(scope): subjectRules:
- Subject is lowercase, no trailing period
- Max 50 chars for subject line
- Include body only if change needs explanation
- NEVER mention AI-generated, drafted by AI, or similar
遵循Conventional Commits规范:
- feat: 新增功能
- fix: Bug修复
- docs: 文档变更
- style: 格式调整(如缺失分号等)
- refactor: 既不修复Bug也不新增功能的代码变更
- test: 添加或修正测试
- chore: 构建流程、依赖项、工具相关变更
格式:
type(scope): subject规则:
- 主题部分小写,末尾不加句号
- 主题行最多50个字符
- 仅当变更需要额外说明时才添加正文
- 绝对不要提及AI生成、由AI起草等相关内容
4. Present to user
4. 向用户展示
Show:
undefined展示内容如下:
undefinedChanges to be committed
待提交的更改
<git status output>
<git status输出内容>
Proposed commit message
建议的提交信息
<type>(<scope>): <subject>
<type>: <description of why>
undefined<type>(<scope>): <subject>
<type>: <变更原因说明>
undefined5. Ask for confirmation
5. 请求确认
Use the tool with options:
question- "Yes, commit" (Recommended)
- "Edit message first"
- "Cancel"
If user chooses "Edit message first", ask them to provide the new message, then re-present.
使用工具提供以下选项:
question- "确认提交"(推荐)
- "先编辑提交信息"
- "取消"
若用户选择"先编辑提交信息",请让用户提供新的提交信息,然后重新展示。
6. Execute
6. 执行提交
On confirmation, run .
If commit fails, show error and offer to fix.
git commit -m "message"用户确认后,运行。
若提交失败,显示错误信息并提供修复建议。
git commit -m "message"Safety rules
安全规则
- NEVER use unless explicitly requested
git push - NEVER use or skip hooks unless user asks
--no-verify - NEVER commit , credentials, or secrets (warn user if detected)
.env - If working tree is clean, inform user there's nothing to commit
- 除非用户明确要求,否则绝对不要使用
git push - 除非用户要求,否则绝对不要使用或跳过钩子
--no-verify - 绝对不要提交文件、凭证或机密信息(若检测到此类内容,需提醒用户)
.env - 若工作区无更改,告知用户没有可提交的内容