commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commit Changes

提交变更

You are tasked with creating git commits for the changes made during this session.
你的任务是为本次会话中所做的变更创建Git提交。

Process:

流程:

  1. Think about what changed:
    • Review the conversation history and understand what was accomplished
    • Run
      git status
      to see current changes
    • Run
      git diff
      to understand the modifications
    • Consider whether changes should be one commit or multiple logical commits
  2. 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
  3. 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?"
  4. Execute upon confirmation:
    • Use
      git add
      with specific files (never use
      -A
      or
      .
      )
    • Create commits with your planned messages
    • Show the result with
      git log --oneline -n [number]
  5. 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
  1. 梳理变更内容:
    • 回顾对话历史,明确完成的工作
    • 运行
      git status
      查看当前变更
    • 运行
      git diff
      了解具体修改内容
    • 判断变更应合并为一个提交还是拆分为多个逻辑提交
  2. 规划提交:
    • 确定哪些文件应归为同一提交
    • 撰写清晰、具有描述性的提交消息
    • 提交消息使用祈使语气
    • 重点说明变更的原因,而非仅描述变更内容
  3. 向用户提交规划:
    • 列出每个提交计划添加的文件
    • 展示你将使用的提交消息
    • 询问:“我计划针对这些变更创建[N]个提交,是否可以执行?”
  4. 获得确认后执行:
    • 使用
      git add
      添加指定文件(绝不要使用
      -A
      .
    • 按照规划的消息创建提交
    • 运行
      git log --oneline -n [number]
      展示执行结果
  5. 生成说明(每次提交后):
    • 运行:
      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
  • 你拥有本次会话所有操作的完整上下文
  • 将相关变更归为一组
  • 尽可能保持提交的聚焦性和原子性
  • 用户信任你的判断——他们请求你执行提交操作