mcpField
R
resolving-merge-conflicts

resolving-merge-conflicts

github.com/ouyangjiahong26Development86 installs
Repository

About resolving-merge-conflicts

resolving-merge-conflicts is a skill for handling Git merge and rebase conflicts as well as unresolved PR review feedback. It traces the intent behind changes, evaluates comments individually, and guides validation, commits, pushes, and review-thread resolution.

Key features

  1. 01Inspect merge or rebase state
  2. 02Trace the intent behind conflicting changes
  3. 03Resolve conflicts hunk by hunk with documented choices
  4. 04Run project automation checks
  5. 05Evaluate PR review comments individually
  6. 06Reply to and resolve review threads

Use cases

  1. 01Resolve file conflicts during a merge or rebase
  2. 02Choose changes using original commits and issue context
  3. 03Fix valid PR review feedback
  4. 04Document rejected feedback and close review threads

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ouyangjiahong26/skills --skill resolving-merge-conflicts

After installing, type/resolving-merge-conflictsin Claude Code to confirm it loaded.

Details

From the project README

git merge / rebase 冲突

  1. 看清当前状态。检查 merge / rebase 进度、git 历史、冲突文件。

  2. 找原始资料。深入理解每处改动为什么这么改,原始意图是什么。读 commit message,查 PR,查原始 issue / ticket。

  3. 逐 hunk 解决。能同时保留两边意图的,就两边都保留。不可调和时,选符合本次合并既定目标的那一边,并记下取舍。不要发明新行为。冲突永远要解决,绝不 --abort。

  4. 找到项目的自动化检查并逐个运行:通常先 typecheck,再测试,最后格式化。把合并弄坏的地方修好。

  5. 收尾 merge / rebase:暂存全部改动并提交。处于 rebase 中时,继续推进直到所有 commit 都 rebase 完。

PR 评审意见

处理 PR 上未解决的评审:自动评审 bot 或人留下的 CHANGES_REQUESTED、逐行 comment 与未解决的评审会话。

  1. 读全部评审结论、逐行 comment 与评审会话:
gh api /repos/<owner>/<repo>/pulls/<PR号>/reviews --jq '.[] | {user: .user.login, state: .state, body: .body}'
gh api /repos/<owner>/<repo>/pulls/<PR号>/comments --jq '.[] | {id, user: .user.login, path: .path, line: .line, body: .body}'
gh api graphql -f query='query { repository(owner:"<owner>", name:"<repo>") { pullRequest(number:<PR号>) { reviewThreads(first:100) { nodes { id isResolved isOutdated path line comments(first:20){ nodes { id author{login} body } } } } } } }'

<owner>/<repo> 由 gh repo view --json nameWithOwner --jq .nameWithOwner 取。评审正文是汇总,逐行 comment 是细节,会话 ID 用于回复与解决,三处都要看。

  1. 逐条判断是否成立。评审意见(含 bot 的)不必然正确:按意见指出的文件与行号核对,必要时读它引用的材料求证。成立的修复。不成立的不改,记下依据。

  2. 修复成立的意见,只动意见涉及的范围。评审常分阻塞与应改两级,全部处理,不只处理阻塞项。

  3. push 分支,让回复里的提交 SHA 指向已推送的修订。

  4. 每条评审会话都回复:采纳的写修复结果与提交 SHA,不采纳的写依据。回复用:

gh api --method POST /repos/<owner>/<repo>/pulls/<PR号>/comments/<commentId>/replies -f body="<回复正文>"

AI 贡献标记按目标仓库的约定,位置与格式照该仓库的 docs/agents/ai-contribution.md 或 docs/agents/issue-tracker.md,语言跟正文一致。

  1. 回复后用 resolveReviewThread 解决会话,逐条确认 isResolved 为 true。push 会让旧会话变为 outdated,outdated 不等于已解决。
gh api graphql -f threadId=<threadId> -f query='mutation($threadId:ID!){resolveReviewThread(input:{threadId:$threadId}){thread{id isResolved}}}'
  1. 自动评审 bot 会重新评审,复审仍提意见时重复本节流程。复审产生的新会话同样回复并 resolve。复审通过或用户确认解决后,合并走 /merge-pr。

Comments

Markdown supported