worktree-manager
Skill12 starsChanged 13 days agoMITView on GitHub
Git Worktree 隔離管理,建立獨立開發環境避免影響主分支。當提到 worktree、分支隔離、隔離開發環境時自動啟用。
- Reads credentials
10 other projects use a version of this.
Adopted by
Most recently taken up by
- kanopi/cms-cultivatortheir own version, first seen Nov 1, 2026
- alessiogarifo92/claude-skillstheir own version, first seen Oct 25, 2026
- chmouel/lazyworktreetheir own version, first seen Oct 8, 2026
- IGTA-Tech/claude-skills-researchtheir own version, first seen Oct 3, 2026
- jtsang4/efficient-codingtheir own version, first seen Sep 12, 2026
- TarasShyn/skillstheir own version, first seen Aug 30, 2026
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- microsoft/WindowsAppSDK★ 4.7ksame name
- chmouel/lazyworktree★ 315same name
- Wirasm/worktree-manager-skill★ 138same name
- kanopi/cms-cultivator★ 17same name
- TarasShyn/skills★ 5same name
- IGTA-Tech/claude-skills-research★ 2same name
- jtsang4/efficient-coding★ 2same name
- miptah21/skills★ 2same name
- vlting/claude-skills★ 2same name
- alessiogarifo92/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- scripts/CLAUDE.mdCLAUDE.md
- skills/gate-guard/hooks/CLAUDE.mdCLAUDE.md
- skills/self-improving-agent/CLAUDE.mdCLAUDE.md
- skills/self-improving-agent/hooks/CLAUDE.mdCLAUDE.md
- skills/tech-diagram-gif/scripts/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- code-simplifierSkill
- dd-loopSkill
- design-brainstormSkill
- frontend-designSkill
- plan-reviewSkill
- reviewSkill
- self-improving-agentSkill
- task-plannerSkill
- tech-diagram-gifSkill
- verification-gateSkill
- writing-great-skillsSkill
The file
Files
Worktree Manager
原生優先(Claude Code ≥ 2.1.198):原生
EnterWorktree工具、CLI--worktree與 subagentisolation: worktree已涵蓋建立、會話遷移與自動清理 — 先用原生。 本 skill 只處理原生不覆蓋的場景:自訂位置慣例、依賴安裝與基線測試、舊版 Claude Code。
收尾第 1 步借鑑 michael-denyer/pstack-claude 的 worktree-cleanup playbook(被 ignore 的 .env 算「刪了就沒了」)。
建立流程
- 前置檢查:確認在 git repo 內、
git status --porcelain乾淨(有未提交變更先提示處理)、git worktree list無同名衝突 - 確認設定(AskUserQuestion 一次問完):分支名(建議
feature/<name>前綴)、 位置(慣例:主 repo 平行目錄../<project>-worktree-<branch>)、是否裝依賴 - 建立:
git worktree add -b <branch> <path> <base-branch> - 環境設定:裝依賴(npm/pip 等,依專案)、複製
.env.example→.env(如存在) - 基線測試:跑既有測試記錄基線 — 失敗時警告但不阻止建立(帶著已知紅燈開發, 之後才分得清是誰弄壞的)
- 記錄:在 worktree 根寫
WORKTREE_INFO.md(分支、base、路徑、基線結果)
收尾
開發完成後:
- 先看 worktree 裡還剩什麼:
git -C <path> status --porcelain --ignored,每一行照下面的規則處理過再往下 (git 2.42.0 與 2.54.0 實測,2026-10-19)。!!那幾行處理完還是會留在輸出裡,這是正常的:M、A這類(還沒 commit 的變更)與??(沒追蹤的檔):git worktree remove會拒絕 (「包含修改或未追蹤的檔案,使用 --force 刪除」,英文是contains modified or untracked files, use --force to delete it)。 不要直接加--force—— 它會把這些連同下一種一起刪掉!!(被 gitignore 的):remove 不會拒絕,會跟著整個目錄直接刪掉、不提示。node_modules/這種裝得回來的不用管;要留意的是只有這裡才有的檔,例如步驟 4 複製出來、之後又改過的.env(用cmp -s <path>/.env <path>/.env.example比,只看結束碼:0 是一樣、1 是改過、2 是比不了(例如.env.example不在), 1 和 2 都列進去問。-s什麼都不印。不要用diff—— 它會把填進去的金鑰印出來。macOS 與 busybox 的cmp實測,2026-10-19)- 上面兩種裡要留的、拿不準的:列出來用 AskUserQuestion 一次問完,不要自己選。
M、??可選 commit、搬到哪、刪掉;!!只給搬到哪、刪掉 —— 被 ignore 的檔多半本來就不該進 git(例如.env)。 步驟 6 寫的WORKTREE_INFO.md每次都會出現在??;它只記這個 worktree 的分支、路徑與基線結果,問的時候可以建議刪掉
- 回主 repo
git worktree remove <path>→git worktree prune
merge 與分支刪除由使用者決定,本 skill 不代決。
限制備忘
- 一個分支只能有一個 worktree;已被 worktree 佔用的分支不能再 checkout
- 子模組專案需特殊處理,先確認再建
- worktree 共用主 repo 的
.gitignore,info/exclude也是共用的 —— 它住在 common dir, 在哪一邊加規則,主 repo 與所有 worktree 都會生效(git 沒有 per-worktree exclude 機制; 實測寫進.git/worktrees/<name>/info/exclude根本不被讀取) - worktree 內不可寫死
.git/info/exclude:worktree 的.git是一個指向 gitdir 的檔案、 不是目錄,照字面路徑寫入必定not a directory失敗(已複現,exit 1)。 要取真實路徑用git rev-parse --path-format=absolute --git-path info/exclude(--path-format需 git ≥ 2.31,見該版 release notes;更早的版本只有git rev-parse --git-path info/exclude,回的是相對路徑)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

