From e92596a2ac8e6970ac4acd4c1d3ddb8a66247af8 Mon Sep 17 00:00:00 2001 From: shunli Date: Sat, 26 Sep 2026 08:48:46 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=20worktree=20?= =?UTF-8?q?=E7=94=9F=E5=91=BD=E5=91=A8=E6=9C=9F=E7=BA=A6=E5=AE=9A(?= =?UTF-8?q?=E6=B2=BB=E7=90=86=E6=96=87=E6=A1=A3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 记录本次会话的教训:worktree 曾累积到16个、占用两位数GB磁盘, 因为清理被推迟。补充判断"何时该删"的具体方法 (git worktree list + merge-base --is-ancestor),供后续开发/agent参考。 --- .trellis/spec/hyb-oa/project-governance.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.trellis/spec/hyb-oa/project-governance.md b/.trellis/spec/hyb-oa/project-governance.md index 81749beb..61c4a9d9 100644 --- a/.trellis/spec/hyb-oa/project-governance.md +++ b/.trellis/spec/hyb-oa/project-governance.md @@ -72,6 +72,14 @@ tasks after TRELLIS2. Do not treat that inferred task as new execution approval. Activate the next approved task explicitly when work actually resumes. Commit, push, archive and production operations retain their separate approval boundaries. +- Worktrees are for genuine isolation (risky merges, DB-touching regression + runs, parallel tasks across sessions/agents), not a default habit. Once the + isolated work is merged or its branch's HEAD is an ancestor of the target + branch, remove the worktree (`git worktree remove`) instead of leaving it + "for later" — this project has previously accumulated over a dozen stale + worktrees consuming double-digit GB of disk because cleanup was deferred. + A quick `git worktree list` + `git merge-base --is-ancestor main` + check identifies safe-to-remove ones during any disk or repo-hygiene pass. ## Risk-Scoped Execution