[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75X9CD6FDMX1RDE9NZEFNVY":3,"skill-same:01M75X9CD6FDMX1RDE9NZEFNVY":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":56,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M75X9CD6FDMX1RDE9NZEFNVY","maintain-fork-pr-merge",null,"当合入 fork 来源的 PR 且 mergeStateStatus=CONFLICTING\u002FDIRTY 时——先 git merge-tree 探测冲突清单，查 maintainer_can_modify，再在 worktree 隔离目录解冲突后 push fork 分支，勿因 CI 绿直接 merge","mambo-wang\u002FCodeWiki-Plus","mambo-wang","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F17296917?v=4","01M75489WXT2KCG0TDVRGMTEET","WanderingBug","01M75WY0F23J9DB5GBVTH8F8Q9",21,"MIT","https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002Frepowiki\u002Fskills\u002Fmaintain-fork-pr-merge\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: maintain-fork-pr-merge\ndescription: 当合入 fork 来源的 PR 且 mergeStateStatus=CONFLICTING\u002FDIRTY 时——先 git merge-tree 探测冲突清单，查 maintainer_can_modify，再在 worktree 隔离目录解冲突后 push fork 分支，勿因 CI 绿直接 merge\ntype: Skill\nstatus: stable\ngenerated:\n  by: codewiki\u002F5.6.1\n  at: \"2026-09-06T11:43:46Z\"\nstale_after: 2026-12-05\nmetadata:\n  summary: fork PR 冲突时的维护者合入 SOP：merge-tree 探测 + worktree 隔离 + push fork\n  source_refs: [\"wiki\u002Fscenarios\u002F发布与依赖治理方法.md\", \"notes\u002F2026-08-26-fork-来源的-pr-与目标分支冲突时的维护者合入流程merge-tree-探测-worktree-push-fork.md\"]\n  revisions: [\"at: \\\"2026-09-06T11:43:46Z\\\"\", {\"at\": \"2026-09-06T11:45:12Z\", \"reason\": \"试用反馈：适用条件补 DRAFT 态 caveat（flag_issue skill-ineffective）\", \"source\": \"skill_creator\"}, {\"at\": \"2026-09-06T11:46:06Z\", \"reason\": \"drift 验证轮\", \"source\": \"skill_creator\"}, {\"at\": \"2026-09-06T11:50:16Z\", \"reason\": \"移除 drift 验证临时段，恢复正式正文\", \"source\": \"skill_creator\"}]\n  reason: created from candidate materials\n  source: skill_creator\n  installed_at: \"2026-09-06T11:50:20Z\"\n  installed_to: .codebuddy\u002Fskills\u002Fmaintain-fork-pr-merge\u002F\n  installed_hash: \"sha256:3aa4f3725ce83a7c9c83531a737828dd674039eb7734fbaf1fc5d23f15db670e\"\n---\n\n\n## 工作场景\n\n维护者合入外部贡献者从 fork 发起的 PR，且 PR 分支与目标分支存在冲突（mergeStateStatus=CONFLICTING\u002FDIRTY）。本仓的典型情境：评审期间 develop 又合入了新提交，导致 fork PR 的改动与主线重叠。\n\n## 适用条件\n\n- PR 的 head 分支在贡献者 fork 仓库中（isCrossRepository=true），本地 `git fetch \u003Cpr-branch>` 会 404\n- `gh pr view --json mergeable,mergeStateStatus` 显示 CONFLICTING 或 DIRTY\n- 注意：此时 CI 检查可能是全绿——CI 通过不等于可合并，以 mergeStateStatus 为准\n- mergeStateStatus=DRAFT（CI 未跑完）时先等结果再探测冲突，勿提前判定\n\n## 核心 SOP\n\n1. 探测冲突清单：`git merge-tree --write-tree --name-only \u003Cbase> \u003Chead>`——无需真实 checkout\u002Fmerge 即可拿到冲突文件列表\n2. 确认可否代改：`gh pr view --json isCrossRepository,headRepository`；fork PR 合入前查 `gh api repos\u002F\u003Cowner>\u002F\u003Crepo>\u002Fpulls\u002F\u003Cn> --jq .maintainer_can_modify`——为 false 时只能请作者解决或换合并策略\n3. 隔离解冲突：工作区有未提交改动时，用 `git worktree add \u003Ctmp> \u003Chead> -b \u003Cbranch>` 在独立目录解决冲突，不污染主工作区\n4. 更新 PR 分支：冲突解决后 `git push https:\u002F\u002Fgithub.com\u002F\u003Cfork-owner>\u002F\u003Crepo>.git \u003Clocal-branch>:\u003Cpr-branch>`（maintainer_can_modify=true 时 GitHub 允许维护者推 fork 的 PR head）\n5. 收尾清理：`git worktree remove --force` + `git branch -D`，再 `gh pr merge --merge`\n\n## 判断逻辑\n\n- mergeStateStatus=DIRTY ≠ CI 失败：先看冲突字段，不要先怪 CI\n- 主工作区是否常驻未提交改动决定是否必须走 worktree：常驻则必须隔离\n- maintainer_can_modify 是代改的前提闸门：false 时一切 push fork 方案不可行\n\n## 禁忌与反模式\n\n- 不要直接在主工作区 checkout PR 分支解冲突（污染未提交改动）\n- 不要因 CI 绿就点 merge（mergeStateStatus 会拒绝，但先探测可省一轮）\n- 不要试图 fetch fork 的分支名到本地远程（不在主仓库，fetch 404 是预期行为）\n- maintainer_can_modify=false 时不要尝试 push fork（无权限，会失败）\n\n","## 工作场景\n\n维护者合入外部贡献者从 fork 发起的 PR，且 PR 分支与目标分支存在冲突（mergeStateStatus=CONFLICTING\u002FDIRTY）。本仓的典型情境：评审期间 develop 又合入了新提交，导致 fork PR 的改动与主线重叠。\n\n## 适用条件\n\n- PR 的 head 分支在贡献者 fork 仓库中（isCrossRepository=true），本地 `git fetch \u003Cpr-branch>` 会 404\n- `gh pr view --json mergeable,mergeStateStatus` 显示 CONFLICTING 或 DIRTY\n- 注意：此时 CI 检查可能是全绿——CI 通过不等于可合并，以 mergeStateStatus 为准\n- mergeStateStatus=DRAFT（CI 未跑完）时先等结果再探测冲突，勿提前判定\n\n## 核心 SOP\n\n1. 探测冲突清单：`git merge-tree --write-tree --name-only \u003Cbase> \u003Chead>`——无需真实 checkout\u002Fmerge 即可拿到冲突文件列表\n2. 确认可否代改：`gh pr view --json isCrossRepository,headRepository`；fork PR 合入前查 `gh api repos\u002F\u003Cowner>\u002F\u003Crepo>\u002Fpulls\u002F\u003Cn> --jq .maintainer_can_modify`——为 false 时只能请作者解决或换合并策略\n3. 隔离解冲突：工作区有未提交改动时，用 `git worktree add \u003Ctmp> \u003Chead> -b \u003Cbranch>` 在独立目录解决冲突，不污染主工作区\n4. 更新 PR 分支：冲突解决后 `git push https:\u002F\u002Fgithub.com\u002F\u003Cfork-owner>\u002F\u003Crepo>.git \u003Clocal-branch>:\u003Cpr-branch>`（maintainer_can_modify=true 时 GitHub 允许维护者推 fork 的 PR head）\n5. 收尾清理：`git worktree remove --force` + `git branch -D`，再 `gh pr merge --merge`\n\n## 判断逻辑\n\n- mergeStateStatus=DIRTY ≠ CI 失败：先看冲突字段，不要先怪 CI\n- 主工作区是否常驻未提交改动决定是否必须走 worktree：常驻则必须隔离\n- maintainer_can_modify 是代改的前提闸门：false 时一切 push fork 方案不可行\n\n## 禁忌与反模式\n\n- 不要直接在主工作区 checkout PR 分支解冲突（污染未提交改动）\n- 不要因 CI 绿就点 merge（mergeStateStatus 会拒绝，但先探测可省一轮）\n- 不要试图 fetch fork 的分支名到本地远程（不在主仓库，fetch 404 是预期行为）\n- maintainer_can_modify=false 时不要尝试 push fork（无权限，会失败）\n\n",{"name":5,"type":24,"status":25,"metadata":26,"generated":47,"description":7,"stale_after":50},"Skill","stable",{"reason":27,"source":28,"summary":29,"revisions":30,"source_refs":41,"installed_at":44,"installed_to":45,"installed_hash":46},"created from candidate materials","skill_creator","fork PR 冲突时的维护者合入 SOP：merge-tree 探测 + worktree 隔离 + push fork",[31,32,35,38],"at: \"2026-09-06T11:43:46Z\"",{"at":33,"reason":34,"source":28},"2026-09-06T11:45:12Z","试用反馈：适用条件补 DRAFT 态 caveat（flag_issue skill-ineffective）",{"at":36,"reason":37,"source":28},"2026-09-06T11:46:06Z","drift 验证轮",{"at":39,"reason":40,"source":28},"2026-09-06T11:50:16Z","移除 drift 验证临时段，恢复正式正文",[42,43],"wiki\u002Fscenarios\u002F发布与依赖治理方法.md","notes\u002F2026-08-26-fork-来源的-pr-与目标分支冲突时的维护者合入流程merge-tree-探测-worktree-push-fork.md","2026-09-06T11:50:20Z",".codebuddy\u002Fskills\u002Fmaintain-fork-pr-merge\u002F","sha256:3aa4f3725ce83a7c9c83531a737828dd674039eb7734fbaf1fc5d23f15db670e",{"at":48,"by":49},"2026-09-06T11:43:46Z","codewiki\u002F5.6.1",1796428800000,"develop","ba8919e7a5182cc94dbe3e9b3a46f4c2e8fa209d","repowiki\u002Fskills\u002Fmaintain-fork-pr-merge",4,"https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus","https:\u002F\u002Fpypi.org\u002Fproject\u002Fcodewiki-plus\u002F","https:\u002F\u002Fgithub.com\u002Fmambo-wang","https:\u002F\u002Fblog.csdn.net\u002Fsinat_27143551","专注Java后端开发，喜欢运动","2026-11-13 15:29:46",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add mambo-wang\u002FCodeWiki-Plus --skill maintain-fork-pr-merge",{"tool":67,"command":68},"bunx","bunx skills add mambo-wang\u002FCodeWiki-Plus --skill maintain-fork-pr-merge",{"tool":70,"command":71},"pnpm","pnpm dlx skills add mambo-wang\u002FCodeWiki-Plus --skill maintain-fork-pr-merge","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002Frepowiki\u002Fskills\u002Fmaintain-fork-pr-merge\u002FSKILL.md",true,[],[76,83,90,97,104,111],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M75XA78546E66PCC3JV2TM3Q","write-doc-file-content-file-sidechannel","write_doc_file 建档报目标路径已被手写文件占用\u002F路由冲突时——走 content_file 临时文件侧通道：正文写临时文件→删占位文件→write_doc_file(content_file=...) 正式建档→删临时文件","https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002Frepowiki\u002Fskills\u002Fwrite-doc-file-content-file-sidechannel\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M75X9YQNDX8B6ZEVMKGM2TYR","windows-python-release","当要手动发布 Python 包（codewiki-plus）到 PyPI 并建 GitHub Release 时——CI 不发布、Windows 控制台为 GBK、可能无 gh CLI、本机网络对 upload.pypi.org 的 Python TLS 握手有干扰——先核对 tag 区间与工作区未提交改动定 bump 级别，再按 8 步主干执行：同步四处版本→bump 提交（只 add 具体文件）→聚焦+ruff+全量闸门→清 dist 构建→PR 合并 main→tag merge commit 建 Release→uv publish（TLS 超时则 curl.exe 直传）→PyPI JSON API 核对","https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002Frepowiki\u002Fskills\u002Fwindows-python-release\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M75X9MGBPRG6JDCRAY97E5T0","windows-dev-env","Windows\u002FPowerShell 下做 git 写操作、跑子进程或批量文件\u002F测试清理时：shell 漂移与中文路径致命令静默失败、无控制台宿主子进程闪窗、GCM 每次弹 OAuth 框、原生 DLL 被锁——须显式复核落盘、subprocess 加 CREATE_NO_WINDOW、gh auth setup-git 持久化凭据，并用 cmd \u002Fc 绕 safe-delete 钩子","https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002Frepowiki\u002Fskills\u002Fwindows-dev-env\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M75X9H4YYF5C29JR7AF44K84","repowiki-conclusion-update","已落库 repowiki 结论发生变化时，按「结论方向 vs 表述」分流：方向变则新写 decision 笔记+reject_note 旧+confirm 并回源 ADR，仅表述\u002F证据变则 edit_doc_file 原地改","https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002Frepowiki\u002Fskills\u002Frepowiki-conclusion-update\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M75X98KRKX80JQ9Y4PR8WZCK","git-commit-hygiene","在共享 worktree 多会话并行或暂存区有残留时提交代码——用显式 pathspec 只提交自己的文件并排除临时目录，禁止 git add -A 或裸 commit 扫入并行会话的改动","https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002Frepowiki\u002Fskills\u002Fgit-commit-hygiene\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M75X974418SW9AX2J45B43Q0","writing-shape","Writing, exploit: shape raw material into an article, paragraph by paragraph.","https:\u002F\u002Fgithub.com\u002Fmambo-wang\u002FCodeWiki-Plus\u002Fblob\u002Fdevelop\u002F.trae\u002Fskills\u002Fwriting-shape\u002FSKILL.md",[],[]]