| name | resolving-merge-conflicts |
| description | Use when you need to resolve an in-progress git merge/rebase conflict. |
| 触发词 | 当需要解决正在进行的 git 合并/变基冲突时使用。 |
Use when you need to resolve an in-progress git merge/rebase conflict.
1. See the current state of the merge/rebase. Check git history, and the conflicting files.
1. 查看当前状态——了解合并/变基的进展。检查 git 历史和冲突文件。
2. Find the primary sources for each conflict. Understand deeply why each change was made, and what the original intent was. Read the commit messages, check the PRs, check original issues/tickets.
2. 查找每个冲突的原始来源。深入理解每项变更的原因和最初意图。阅读提交信息,查看 PR,查看原始 issue/工单。
3. Resolve each hunk. Preserve both intents where possible. Where incompatible, pick the one matching the merge's stated goal and note the trade-off. Do not invent new behaviour. Always resolve; never --abort.
3. 逐个解决每个冲突块。尽可能保留双方的意图。当意图不兼容时,选择与合并目标一致的那一方,并记录取舍。不要引入新行为。始终解决冲突,永远不要 --abort。
4. Discover the project's automated checks and run them — typically typecheck, then tests, then format. Fix anything the merge broke.
4. 发现项目的自动化检查并运行它们——通常是类型检查、测试、格式化。修复合并导致的任何问题。
5. Finish the merge/rebase. Stage everything and commit. If rebasing, continue the rebase process until all commits are rebased.
5. 完成合并/变基。暂存所有更改并提交。如果是变基,继续变基流程直到所有提交完成变基。