parallel-worktrees
Skill0 starsChanged 52 days agoMITView on GitHub
Work safely when several people or agent sessions share one repository through git worktrees or parallel checkouts. Use when a repo has sibling worktrees, when changes appear that you did not make, when a stash or branch goes missing, or when setting up a repo for concurrent agent sessions.
- Commits and pushes
6 other projects use a version of this.
Adopted by
Most recently taken up by
- paureis/pau-skillstheir own version, first seen Nov 8, 2026
- mqmalagris/agent-skillstheir own version, first seen Nov 5, 2026
- theexperiencecompany/gaiatheir own version, first seen Nov 3, 2026
- TheBeardedBearSAS/claude-crafttheir own version, first seen Oct 29, 2026
- rohitg00/pro-workflowtheir own version, first seen Sep 29, 2026
- kiku-jw/codex-skillstheir own version, first seen Jul 28, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- rohitg00/pro-workflow★ 2.9ksame name
- theexperiencecompany/gaia★ 325same name
- TheBeardedBearSAS/claude-craft★ 108same name
- paureis/pau-skills★ 2same name
- kiku-jw/codex-skills★ 0same name
- mqmalagris/agent-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 repository17 other files it gives its agents.
- access-control-proofSkill
- agent-instructionsSkill
- contract-changeSkill
- data-change-scriptSkill
- deploy-safetySkill
- design-critiqueSkill
- evidence-layersSkill
- interface-craftSkill
- issue-ledgerSkill
- mobile-field-readinessSkill
- offline-first-syncSkill
- requirements-elicitationSkill
- root-cause-investigationSkill
- solution-architectureSkill
- ux-state-coverageSkill
- versioned-publishingSkill
- skill-nameSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 15
Not the branch — the directory.
- Distinctive: line 25
Do this at the start of a session and again after anything that changes directory.
- Distinctive: line 88
Before creating one, check whether the name is taken:
- Distinctive: line 94
Never delete a branch you did not create, and never force-push a shared one.
- Distinctive: line 111
Use the repo's sync script if it has one.
- Very specific: line 116
When a file looks different from what you expect: check git log -5 <file> before assuming breakage.
“Common” is measured: kept by at least 6 in 10 of the 6 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
Parallel worktrees
Git worktrees give each session its own working directory and its own branch. What they do not give each session is its own object store, stash stack, branch namespace, or anything outside git at all. Almost every surprise comes from assuming isolation that is not there.
1. Know which checkout you are in, before you touch anything
Not the branch — the directory. The same branch can be checked out in several places, and the instructions for "run the deploy from here" usually mean one specific path.
git rev-parse --show-toplevel # which worktree am I in
git worktree list # what else exists, and on what branch
git status -sb # branch, ahead/behind, dirtyDo this at the start of a session and again after anything that changes directory. Paths in project docs are frequently relative to one particular checkout.
2. What is shared, and what is not
| Shared across every worktree | Private to each worktree |
| Objects, refs, remotes | Working tree |
| The stash stack | Index |
| Branch names (a branch is checked out in one place at most) | HEAD |
| Hooks, most config | Untracked and ignored files |
| Everything outside git: databases, ports, cloud resources, locks | Local env files, build output |
The stash stack is the one that catches people, because nothing about
git stash suggests it is global.
3. Never use bare git stash or git stash pop
With concurrent sessions, stash@{0} is whatever was pushed most recently by
anyone. A bare pop can silently take someone else's work and drop it into
your tree, corrupting both sessions in a way that is hard to notice and harder
to undo.
The safe alternative, in order of preference:
- A temporary commit.
git commit -am "wip"on your own branch, thengit reset --soft HEAD~1later. It is per-worktree, it is recoverable from the reflog, and it cannot be taken by anyone else. - A tagged stash, applied by hash:
git stash push -u -m "my-unique-tag"
git stash list --format='%H %gs' # capture YOUR entry's hash
git stash apply <hash> # apply, never pop
git stash drop <the stash@{n} that matches your tag now>Re-find the index by tag before dropping. Positions shift as other sessions push and drop.
4. Shared resources outside git need a protocol
Databases, local servers, fixed ports, cloud stacks, deploy pipelines and test accounts are shared by every session on the machine.
- Per-worktree ports. Derive the port from the directory name or keep a small map, and start the dev server through a wrapper that applies it. Two sessions racing for port 5173 produce an extremely confusing afternoon in which one session's changes appear in the other's browser.
- One designated worktree for deploys and production-data scripts. Not because the code differs, but because the humans need one place to look.
- A real lock for anything that must not run twice — a conditional write to a small table, a CI concurrency group — with a status command and a TTL.
- Shared local services started once, from a documented checkout, not by whichever session got there first.
5. Branches are a shared namespace
A branch can be checked out in exactly one worktree. git checkout other-branch
fails when a sibling holds it, and that error is correct — do not work around it
by force. Create your own branch from the integration branch instead.
Before creating one, check whether the name is taken:
git worktree list && git branch -a --contains HEADNever delete a branch you did not create, and never force-push a shared one. If you rebase a branch another worktree has checked out, that worktree's next operation will be baffling.
6. Merge back often
Long-lived parallel branches are where the real cost shows up. Integrate in both directions on a regular cadence — daily is not too often when several sessions are moving:
git fetch origin
git merge origin/develop # take everyone else's work
# ... resolve, test ...
git push # publish yoursUse the repo's sync script if it has one; it usually encodes ordering the raw commands do not.
7. Changes you did not make are not necessarily wrong
When a file looks different from what you expect: check git log -5 <file>
before assuming breakage. Another session may have fixed it three minutes ago.
Likewise, do not "tidy" files outside the scope of your task. In a single-session repo that is a small courtesy; here it produces conflicts in someone else's active work.
8. Untracked config does not propagate
Local env files, credentials and scratch directories are per-worktree and usually gitignored, so a new worktree starts without them and fails in ways that look like code problems.
Whatever creates worktrees should copy them, and the README should list what a fresh worktree needs. When something works in one checkout and not another, this is the first thing to check.
Checklist
- Working directory and branch confirmed at the start of the session
- No bare
git stash/git stash pop; WIP commit or tagged stash applied by hash - Ports, local services and cloud resources deconflicted per worktree
- Deploys and data scripts run from the designated checkout, behind a lock
- Own branch created from the integration branch; no force-push on shared branches
- Merged from the integration branch recently
- Unexpected changes checked with
git logbefore being treated as breakage - Untracked local config present in this worktree
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.

