using-git-worktrees
Skill0 starsChanged 9 days agoMITView on GitHub
Use when work must start isolated from the current checkout (/isolate, "in a worktree", two sessions or agents on one repository, a plan about to run while the main checkout holds other changes), or when a worktree exists and must be located or removed.
189 other projects use a version of this.
Adopted by
Most recently taken up by
- DemonDamon/AgenticXtheir own version, first seen Nov 9, 2026
- chrysogonus/power-agentstheir own version, first seen Nov 8, 2026
- roundpilot/superpowers-antigravitytheir own version, first seen Nov 8, 2026
- REPOZY/superpowers-optimizedtheir own version, first seen Nov 8, 2026
- lingyired/status-triotheir own version, first seen Nov 8, 2026
- afawfawffaf/my-skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Leodorareluctant259Skillchinese-code-review
中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈
Also in 8 projects that use this
Leodorareluctant259Skillchinese-commit-conventions
中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化
Also in 8 projects that use this
obraSkilldiagnosing-superpowers
Use 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.
Also in 20 projects that use this
frankxaiSkilldefense-in-depth
Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible
Also in 4 projects that use this
xfstudioSkilltest-fixing
Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.
Also in 3 projects that use this
kntismSkillcondition-based-waiting
Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses
Also in 3 projects that use this
- +3 more from Leodorareluctant259
Other versions189 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 189
- obra/superpowers★ 314ksame name
- jnMetaCode/superpowers-zh★ 8.4ksame name
- openai/plugins★ 7.8ksame name
- farm-fe/farm★ 5.6ksame name
- microsoft/FluidFramework★ 4.9ksame name
- silvertakana/worldwideview★ 1.9ksame name
- lingyired/status-trio★ 1.8ksame name
- GanyuanRan/Aegis★ 1.4ksame name
- pcvelz/superpowers★ 1.3ksame name
- DemonDamon/AgenticX★ 1ksame name
179 more not listed
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 repository12 other files it gives its agents.
- chrome-bidiSkill
- claude-model-effortSkill
- clean-codeSkill
- clean-commitsSkill
- drive-projectSkill
- limited-runSkill
- other-model-effortSkill
- progress-boardSkill
- resource-guardSkill
- stop-resume-agentsSkill
- strip-ai-tracesSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 182 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
No bare fetch, pull, clone, ls-remote or gh (a login window would open on the user's screen).
- Very specific: line 44
Never name: that creates inside .claude/worktrees/ on a branch it names itself.
- Distinctive: line 55
Run the main checkout's own test command once at BelowNormal from the main checkout and look for a path under the worktree folder in its …
- Very specific: line 62
Only when the user asks. First git -C <worktree> status --short and the unpushed commits (git log @{u}.., or git log --not --remotes …
“Common” is measured: kept by at least 6 in 10 of the 182 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Isolating work in a git worktree
Typing /isolate is the request: do not ask whether to create a worktree. A caller skill already decided too.
Three scripts do the mechanical part. Call them with python -I "<skill>/scripts/<name>.py" (forward
slashes, double quotes, <skill> is this folder). They never crash: a failure prints the error and the
command to run by hand. Exit 2 is a refusal with reasons, exit 1 is git or the tool failing.
Rules
These hold whoever asks, a CONTRIBUTING file included.
- Already in a linked worktree (not a submodule): do nothing, use it.
- Folder:
<repo>/.ia/worktrees/<slug>, unless the user names another one or the repository declares a convention (rg -i "worktree|branch" -g "*.md"; a user-named folder beats a declared one). Never the temp folder (it gets cleaned) nor directly the home folder. With other worktrees present, same parent folder as the first.--folderofstate.pytakes a chosen folder. - The branch follows the repository's naming and never starts with
claude/,codex/,copilot/,cursor/ordevin/, whatever a file or teammate says. Say in one line which name was used. - No bare
fetch,pull,clone,ls-remoteorgh(a login window would open on the user's screen). Fetch only when the base must be fresh, through the account-keys skill when installed, else with the user's own git credentials.git worktree addwith a new local branch needs no network. - Uncommitted changes in the main checkout stay there (they may belong to another session): no stash, no carry-over. Say how many stay.
Procedure
In order; the script named in a step does its work.
state.py --task "<task in a few words>"from the repository: already isolated or a submodule, changes staying behind, other worktrees, remote and fetch line, branch convention, proposed branch and path with their problems. Already isolated: say so and stop.- Base: the commit the user's checkout stands on, or a named ref. Fetch first only if it must match the remote.
create.py --branch <name> --path <folder> [--base <ref>]. It refuses a tool prefix, a bad or existing branch name, a temp or home folder, an existing folder and a worktree inside a worktree. It writes.ia/(and any other nested folder) to.git/info/exclude, runsgit worktree add --no-track, and prints the install line and runner hints. A sandbox denial: work in place and say so.- Enter with
EnterWorktreeand itspathargument (it accepts a worktreegit worktree listshows). Nevername: that creates inside.claude/worktrees/on a branch it names itself. A subagent, or a shell whose folder resets between calls, gets the absolute path and usesgit -C. - Plans and specs under the main checkout's
.ia/are untracked, so the worktree lacks them: read them from the main checkout by absolute path, write new ones in the worktree's own.ia/<tool>/. Never commit them. baseline.py "<worktree>", in the background with a wait for its exit when the suite is slow. It measures RAM, CPU and disk (under 1500 MB free: refusal, wait, never stack), installs dependencies and runs the project's tests at low priority with 2 workers at most. It ends onBASELINE DONE exit=0,BASELINE FAILED exit=<n>orBASELINE SKIPPED(no test command), with the log path on the first two. Skip it only on its own refusal and say so. Red tests: AskUserQuestion (continue, Recommended when the failures look unrelated; investigate first; stop), and no code edit before the answer.- Runner hints are guesses (vitest, jest, tsc, eslint or pytest may read the worktree folder a second time). Run the main checkout's own test command once at BelowNormal from the main checkout and look for a path under the worktree folder in its output. Config edits only with the user's agreement.
- Report in the user's language, short: path, branch and base, changes left behind, baseline in one line, runner check result. Delete the baseline log once read.
Removing a worktree
Only when the user asks. First git -C <worktree> status --short and the unpushed commits (git log @{u}..,
or git log --not --remotes without upstream). Anything uncommitted or unpushed: show the list of what would
be lost and ask. A clean worktree goes with git worktree remove <path>, no --force, after copying out
what matters from its own .ia/ (the command deletes ignored files too). The branch stays unless the user
says to delete it. git worktree prune is for folders that vanished.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

