SuperAPI AI Directory

resolving-merge-conflicts

Coding & development

View repository

Updated 10-16 08:39

About this skill

Resolving Merge Conflicts
  1. Confirm the current state. Check the Git status, history, and conflicted files, distinguish whether a merge or a rebase is in progress, and read the applicable project rules.

  2. Determine the intent of both sides. Find first-hand evidence for each conflict and understand the reasons and original intent behind both sides' changes. Prioritize reading relevant commit messages, code history, PRs, issues, task cards, and requirements documents.

  3. Resolve conflicts block by block. When compatible, preserve the intent of both sides; when incompatible, choose the option that aligns with the explicit goal of this merge/rebase and explain the trade-offs. If the intent still cannot be determined and different choices would change the outcome, use the question tool to confirm before making changes. Do not invent new behavior; unless the user explicitly switches to abandoning this operation, continue resolving and do not execute --abort。

  4. Run project checks. Identify the project's existing automated checks and run checks proportionate to the scope of the conflict, typically including type checking, tests, and formatting checks in that order. Only fix problems introduced by this conflict resolution.

  5. Complete the merge/rebase. Stage only the files involved in this conflict resolution, without absorbing unrelated changes; continue the current operation. If subsequent commits in the rebase produce new conflicts, repeat the above process until Git no longer reports unresolved files and the merge/rebase state has ended.