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 從公開儲存庫中收錄這些內容。

檢舉或申請下架