Git 工作流
what files have I changed?更稳的起手式:
请查看 git status 和当前 diff,总结我改了什么。先不要改文件。commit my changes with a descriptive message in conventional commits format提交前建议让 Claude Code 做一次本地 review:
review my current diff for bugs, missing tests, and accidental unrelated changes. Do not edit files yet.create a branch feature/add-validation and switch to it如果仓库可能有未保存或他人改动,先问:
check whether it is safe to create a new branch nowCode Review
Section titled “Code Review”review my staged changes and suggest improvements before I commit一个高质量 review 提示词:
Please review my staged changes as a senior engineer.Prioritize correctness bugs, security issues, regressions, and missing tests.List findings first with file references. Do not rewrite the code unless I ask.合并冲突适合分步做:
- 让 Claude Code 先运行
git status并解释冲突文件。 - 指定一个文件解决,不要一次处理全部。
- 解决后运行相关测试。
- 再检查 diff,确认没有误删双方改动。
- 合并、强推等危险操作前务必看清 Claude 将要执行的命令
- 大型合并冲突建议分步:先
git status,再指定文件解决 - 如果工作区已有你不确定来源的改动,先让 Claude Code 总结,不要直接 reset
- 生产分支、发布分支、强推操作要按团队流程审批