Skip to content

ccoalm/ccl-skills / skills/worktree-isolation

worktree-isolation

Unverified

开工前先在独立 git worktree 里再改代码——**绝不在 main(主检出/main 分支)上开发**,任何迭代/功能/哪怕一行修改都先建分支+worktree(并发只是让这条更刚性,单人单线同样适用);worktree 集成回目标分支后立即清理 worktree+本地分支+远端分支(让位见收尾节)。Never develop on the main checkout/branch — always create a dedicated worktree first (concurrency only makes it stricter, not a precondition); also covers teardown/cleanup when a worktree is integrated. 触发:凡要动代码,动手前先过本技能 Step 0(由 owner 在其实现阶段调用,本技能不抢交付入口)、并行做两个版本、改 ccl-skills 等共享仓库、被隔离闸 deny、worktree 干完要清理时。Skip when:交付级的重新开发/推倒重来/清除代码重来("之前那版不要了,重新开发")先回 product-rd-workflow 重新分类+重建计划——本技能只管 worktree 机制,不替代交付重入决定;product-rd 重入后仍按本技能 Step 0 先建 worktree 再动手,绝不在 main 上重写。

FileKindSize
SKILL.mdskill md13.6 KB
agents/openai.yamlconfig261 B
references/hook-authorization.mdmarkdown1.7 KB
references/merge-and-teardown.mdmarkdown18.9 KB
references/pre-merge-landing-checks.mdmarkdown8.3 KB
references/shared-branch-rebase.mdmarkdown2.2 KB
scripts/AGENTS.mdmarkdown1007 B
scripts/test_worktree_status.shexecutablescript8.4 KB
scripts/test_worktree_sweep.shexecutablescript27.0 KB
scripts/worktree-status.shexecutablescript13.4 KB
scripts/worktree-sweep.shexecutablescript12.7 KB

references/shared-branch-rebase.md

View on GitHub
# 已共享分支的安全 rebase

动作、停止条件和推送命令以 `worktree-isolation/SKILL.md`「把落后分支更新到最新目标」的共享分支条目为准;默认 merge / 平台 update 及方向报告以 `merge-and-teardown.md`「收尾」节的「合并方向必须可读」为准。本页只解释这些硬规则为何不可放松。

## 为什么只信本分支的这次 fetch

目标必须先按入口上文刷新。随后只 fetch 本分支一次并立即保存 `FETCH_HEAD`;单分支 fetch 在 refspec 不匹配时可能不更新 remote-tracking ref,因此它不能替代入口保存的字面 OID。之后可 fetch 其它 ref,但必须继续使用已保存的 `remote_oid`;再次 fetch 本分支并换钉值,会把观察后的并发推进错当成新基线。

## 为什么 lease 必须显式绑定

远端在观察后发生变化时,显式 OID lease 会拒绝推送。裸 `--force-with-lease` 使用本地 tracking ref;后台 fetch、IDE 自动 fetch 或同仓其它命令都可能推进它,使租约从“与我审阅的 OID 比较”退化为“与远端现状比较”,从而覆盖别人刚推的提交。

## 为什么重写后证据全部失效

重写会改变 commit hash 和行内评论锚点;旧评审线程、approval、mergeable 与 CI 状态不再证明当前提交。工具若把重写和发布合成一步,无法在两者之间验证,只能在返回后逐层重验,并在全部通过前保持 PR 不合并。

## 为什么入口只留判据、理由放这里

私有 / 未推送分支允许 rebase 的理由是历史更干净:没有别人基于它工作,重写不会让谁的本地副本对不上。
这是理由不是判据——判据只有「分支是否已共享」一条,入口留判据即可。

入口里 `git rev-list --left-right --count <branch>...$remote_oid` 的 `右侧(远端独有)` 这个限定词不能省。
左右两列谁是本地独有、谁是远端独有,命令本身不自证;读者一旦猜反,停止条件整个倒过来——
本该「远端有而本地没有 → 并入、禁 rebase」,会被读成「本地有而远端没有 → 可以 rebase」,
正好在存在远端独有提交时执行重写,把别人的提交盖掉,而这正是这条规则要防的事。
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall