commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit Changes
提交变更
You are tasked with creating git commits for the changes made during this session.
你的任务是为本次会话中所做的变更创建Git提交。
Process:
流程:
-
Think about what changed:
- Review the conversation history and understand what was accomplished
- Run to see current changes
git status - Run to understand the modifications
git diff - Consider whether changes should be one commit or multiple logical commits
-
Plan your commit(s):
- Identify which files belong together
- Draft clear, descriptive commit messages
- Use imperative mood in commit messages
- Focus on why the changes were made, not just what
-
Present your plan to the user:
- List the files you plan to add for each commit
- Show the commit message(s) you'll use
- Ask: "I plan to create [N] commit(s) with these changes. Shall I proceed?"
-
Execute upon confirmation:
- Use with specific files (never use
git addor-A). - Create commits with your planned messages
- Show the result with
git log --oneline -n [number]
- Use
-
Generate reasoning (after each commit):
- Run:
bash "$CLAUDE_PROJECT_DIR/.claude/scripts/generate-reasoning.sh" <commit-hash> "<commit-message>" - This captures what was tried during development (build failures, fixes)
- The reasoning file helps future sessions understand past decisions
- Stored in
.git/claude/commits/<hash>/reasoning.md
- Run:
-
梳理变更内容:
- 回顾对话历史,明确完成的工作
- 运行查看当前变更
git status - 运行了解具体修改内容
git diff - 判断变更应合并为一个提交还是拆分为多个逻辑提交
-
规划提交:
- 确定哪些文件应归为同一提交
- 撰写清晰、具有描述性的提交消息
- 提交消息使用祈使语气
- 重点说明变更的原因,而非仅描述变更内容
-
向用户提交规划:
- 列出每个提交计划添加的文件
- 展示你将使用的提交消息
- 询问:“我计划针对这些变更创建[N]个提交,是否可以执行?”
-
获得确认后执行:
- 使用添加指定文件(绝不要使用
git add或-A). - 按照规划的消息创建提交
- 运行展示执行结果
git log --oneline -n [number]
- 使用
-
生成说明(每次提交后):
- 运行:
bash "$CLAUDE_PROJECT_DIR/.claude/scripts/generate-reasoning.sh" <commit-hash> "<commit-message>" - 该脚本会记录开发过程中的尝试(构建失败、修复方案等)
- 说明文件有助于后续会话理解过往决策
- 存储路径为
.git/claude/commits/<hash>/reasoning.md
- 运行:
Important:
重要提示:
- NEVER add co-author information or Claude attribution
- Commits should be authored solely by the user
- Do not include any "Generated with Claude" messages
- Do not add "Co-Authored-By" lines
- Write commit messages as if the user wrote them
- 绝不要添加共同作者信息或Claude相关署名
- 提交应仅以用户作为作者
- 不要包含任何“由Claude生成”的消息
- 不要添加“Co-Authored-By”行
- 撰写提交消息时,要模拟用户的口吻
Remember:
注意事项:
- You have the full context of what was done in this session
- Group related changes together
- Keep commits focused and atomic when possible
- The user trusts your judgment - they asked you to commit
- 你拥有本次会话所有操作的完整上下文
- 将相关变更归为一组
- 尽可能保持提交的聚焦性和原子性
- 用户信任你的判断——他们请求你执行提交操作