git-worktree
Use Git worktrees to isolate parallel coding tasks
Install / Use
npx skills add davidondrej/skills --skill git-worktreeInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Our assessment of git-worktree
git-worktree scores 84/100 on our quality scale, 2870th of 4,698 Development & Engineering skills we index.
Its SKILL.md is 5.2 KB long, well organised into 9 sections with 5 code examples: a solid amount of guidance for an agent.
With 4,079 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so git-worktree is actively maintained.
- Our last check on 2026-11-05 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-11-16. Automated pattern scan on 2026-11-16. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
git-worktree compared with similar skills
All 4 of these similar skills score higher than git-worktree; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| git-worktree (this skill)by davidondrej | 84 | 4.1k | 53d ago | SKILL.md |
| taste-skillby Leonxlnx | 100 | 116.8k | 8d ago | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 8d ago | CLAUDE.md |
| ai-job-searchby ai-job-search-dev | 100 | 72.1k | today | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 47.3k | 2d ago | CLAUDE.md |
Frequently asked questions
- How do I install git-worktree?
- Run
npx skills add davidondrej/skills --skill git-worktree. The install tabs above show the steps for each supported agent. - Which AI agents does git-worktree work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is git-worktree safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is git-worktree still maintained?
- The repository was last updated about 2 months ago, so git-worktree is actively maintained.
Skill content
View source on GitHubname: git-worktree description: Use Git worktrees to isolate parallel coding tasks. Use when setting up a task checkout, working in a shared repo, or managing existing worktrees. disable-model-invocation: true triggers: [user, model]
Git Worktrees for Parallel Agents
In Cloudroom ($ROOM_THREAD_ID is set)
Never run git worktree add yourself. Cloudroom only deletes worktrees it made, so hand-made ones pile up in ~/code forever.
-
New task: start the thread with New worktree instead.
-
Move this thread to its own worktree: fork it into a Cloudroom-managed worktree. Cloudroom makes the branch and deletes the folder once its last thread is archived (after the worktree retention setting, default 21 days).
room-cli thread fork "$ROOM_THREAD_ID" --new-environment worktree --title "<task>" \ --prompt "You now run in a new worktree. Copy the gitignored .env files from <primary checkout> into it, then stop and wait for the user."It branches from
main, so uncommitted edits stay behind; commit them first or pass--base-branch <ref>. Then tell the user to continue in the new thread and archive this one. Skip the rest of this skill.
Start here
Detect where you are before editing:
[ "$(git rev-parse --path-format=absolute --git-dir)" = "$(git rev-parse --path-format=absolute --git-common-dir)" ] \
&& echo "primary checkout" || echo "worktree"
- Primary checkout → create a task-named worktree, complete the setup below, and
cdinto it before editing. - Worktree (including one created by Cursor) → proceed with the task.
Working model
Worktrees have separate working files and branches but share Git history, stashes, config, and refs.
- One task = one worktree = one agent session. Never share a working directory between agents.
- Keep the primary checkout on main, only for review, merging, and pushing.
- Nothing auto-merges. The human reviews each diff before merging or discarding the worktree.
- Keep task branches local and short-lived. Push only main unless the user explicitly asks to push a task branch.
- Merge one worktree at a time. If main moved, rebase the task branch before merging.
Creating and removing
git 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
A branch can be checked out in only one worktree, including main.
In Cursor, use the Agents Window or /worktree <task>. /apply-worktree applies results to the main checkout; /delete-worktree discards them. /best-of-n model1,model2 <task> runs the same task in parallel worktrees, one per model. Cursor auto-deletes older worktrees, so preserve results promptly; pushing task branches still requires explicit approval.
Complete the setup
A fresh worktree contains tracked files only. Bootstrap it before task work:
- Env/secret files — copy
.env,.env.local, and similar files from the primary checkout. Never symlink them: edits would change the originals. - Dependencies — install locally (
npm ci,pnpm install,uv sync,bundle install). Never symlinknode_modulesfrom the primary checkout: bundlers such as Next.js/Turbopack reject paths outside the worktree. If it is a symlink, remove it withrm -f node_modulesand install normally. - Databases and services — choose shared or per-worktree state. For shared services, pin their identity to avoid duplicate instances and port conflicts. For shared Docker Compose services, pin the project name, for example with a top-level
name:; otherwise each worktree's folder name creates a separate project. Copy or re-seed per-worktree state such as SQLite files. - Ports — run dev/test servers and debuggers one at a time, or configure separate ports per worktree.
- Generated files and caches — rebuild gitignored output in the worktree (
npm run build, codegen). - Git hooks —
core.hooksPathand.git/configare shared; verify hook scripts don't assume the primary checkout's path.
Automate setup
In Cursor, .cursor/worktrees.json runs setup on creation ($ROOT_WORKTREE_PATH is the primary checkout):
{
"setup-worktree": [
"npm ci",
"cp $ROOT_WORKTREE_PATH/.env.local .env.local"
]
}
Otherwise, put the checklist in scripts/setup-worktree.sh and run it first in each new worktree. Find the primary checkout from a worktree with:
dirname "$(git rev-parse --path-format=absolute --git-common-dir)"
Merge and clean up
# 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
In Cursor, use /apply-worktree, then review and commit.
- Delete each worktree as soon as its branch is merged or pushed to main. Nothing else cleans them up.
- Rebase or restart worktrees that have stalled for days.
- Commit early and often. Deleting a worktree loses uncommitted work; commits remain in the shared repository.
Related Skills
taste-skill
116.8kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
ai-job-search
72.1kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
47.3kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
