Resolve Pr Conflicts

jssblck/agents/skills/resolve-pr-conflicts

作者 jssblck8715dcc8a572无许可证收录于 2026年10月9日更新于 2026年10月9日仓库今天更新

Use when a PR has merge conflicts with its base branch, including conflicts found during babysitting or merging.

AI 生成的概览

指导代理更新拉取请求分支,以解决与基础分支的合并冲突。

功能
该技能提供了一套解决开放拉取请求合并冲突的分步流程。内容包括检查 PR、在临时工作树中操作、获取 PR 头部与基础分支、合并或变基到基础分支、解决冲突块,并在合并后的代码树上运行构建、格式化、检查和测试。它还涵盖在获得授权时使用 force-with-lease 推送已验证的更新、重新检查可合并性并报告结果。
适用场景
当拉取请求与其基础分支存在合并冲突时使用,包括在照看或合并 PR 过程中发现的冲突。它用于更新 PR 自身分支,而非合并 PR 或将其重定向到其他基础分支。
运行要求
需要 GitHub CLI(gh)和 Git,以及访问相关仓库的网络连接。需要仓库关于合并还是变基的指引、复刻权限,以及在重写非本人拥有的分支前获得明确批准。该技能不附带脚本,仅引用一份冲突处理指南文档。

Resolve PR conflicts

Update the PR's own branch against its current base. This skill does not authorize merging the PR or retargeting it to another base.

Inspect and update

sh
gh pr view <n> -R <owner/repo> --json state,headRefName,headRefOid,baseRefName,mergeable,isCrossRepository,maintainerCanModify
  1. Confirm the PR is open and record its head SHA and base branch.
  2. Work in a temporary worktree, preserving existing local edits.
  3. Fetch the PR head and base from their actual repositories; record the base tip.
  4. Confirm fork permissions and the destination remote before updating the PR branch.
  5. Merge or rebase onto the fetched base according to the repository's guidance.

Get explicit approval before rewriting a branch you do not own, unless already authorized in the session. Disclose every rewrite. Use an explicit --force-with-lease=<branch>:<recorded-head-sha> for an authorized rewrite. If another contributor moved the PR head, stop and reconcile with its owner. Never push to the base branch.

Resolve and verify

Read the conflict guidance [blocked] before resolving hunks. Preserve both changes' intent and check for semantic conflicts even when Git merges cleanly. Ask when the resolution requires a product decision.

  1. Resolve the conflicts and complete the merge or rebase.
  2. Run the repository's relevant build, format, lint, and tests on the combined tree.
  3. Recheck the remote head and base before pushing.
  4. If the base moved, recheck for conflicts and apply the repository's freshness requirements. Preserve concurrent head changes and verify any changed result.
  5. Push the verified update to the PR branch within the user's authorized scope.
  6. Re-read the PR head and mergeability after the push.
  7. Remove the temporary worktree after preserving the completed work.

Report the resolved conflicts, any rewrite, checks run, and remaining blockers. Return to the calling workflow for CI watching or an authorized merge.

来源与署名

来源:jssblck/agents位于skills/resolve-pr-conflicts提交8715dcc

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架