Loading...
Loading...
Use git worktrees to run multiple coding agents in parallel on one repo without collisions. Use when starting a task in a shared repo, when the user says "worktree", "parallel agents", "one worktree per task", or when agents keep overwriting each other's changes. Covers creating worktrees, making them as complete as the main checkout (.env files, dependencies, databases, ports), merging back, and cleanup.
npx skill4agent add davidondrej/skills git-worktree[ "$(git rev-parse --path-format=absolute --git-dir)" = "$(git rev-parse --path-format=absolute --git-common-dir)" ] \
&& echo "primary checkout" || echo "worktree"cdgit worktree add.gitgit worktree add ../myrepo-task-x # new worktree + branch "myrepo-task-x"
git worktree add ../fix-y -b fix-y main # explicit branch off main
git worktree list # see all worktrees
git worktree remove ../myrepo-task-x # delete when merged/abandoned
git worktree prune # clean up stale registrations/worktree <task>/apply-worktree/delete-worktree/best-of-n model1,model2 <task>.env.env.localnpm cipnpm installuv syncbundle installnode_modulesname:npm run buildcore.hooksPath.git/config.cursor/worktrees.json$ROOT_WORKTREE_PATH{
"setup-worktree": [
"npm ci",
"cp $ROOT_WORKTREE_PATH/.env.local .env.local"
]
}scripts/setup-worktree.shdirname "$(git rev-parse --path-format=absolute --git-common-dir)"# from the primary checkout, after reviewing the worktree's diff:
git merge --no-ff task-branch # or: git merge --squash task-branch
git worktree remove ../myrepo-task-x
git branch -d task-branch/apply-worktreenode_modules