git-worktree
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
Skill by tattooinmtl
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/tattooinmtl-git-worktree
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: productivity, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/git-worktree
What's inside
- Skill name
git-worktree- Description
- 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.
- License
- MIT
- Instructions
- 92 lines in SKILL.md · view on GitHub
Agent Skills spec issues
- files: referenced but missing: scripts/setup-worktree.sh
Files (2)
- SKILL.md
- openai.yaml · agents/
SKILL.md (first lines)
# Git Worktrees for Parallel Agents
## Start here (before any task work)
Detect where you are:
```bash
[ "$(git rev-parse --path-format=absolute --git-dir)" = "$(git rev-parse --path-format=absolute --git-common-dir)" ] \
&& echo "primary checkout" || echo "worktree"
```
- **Primary checkout** → do NOT start editing here. Create a worktree named after the task, bootstrap it (see "Making the worktree complete"), `cd` into it, and do ALL task work there.
- **Worktree** (e.g. Cursor already started you in one) → proceed with the task.
## What a worktree is
One repo, multiple folders. `git worktree add` creates an extra checkout of the same repository in a separate directory, on its own branch. All worktrees share one `.git` history, but each has its own files. Two agents in two worktrees physically cannot overwrite each other's work.
## The working model
- **One task = one worktree = one agent session.** Never let two agents share a working directory.
- **The primary checkout is the integration point.** It stays on the main branch and is used only to review, merge, and push. It is not a scratchpad.
- **Nothing auto-merges.** The human reviews each worktree's diff, then merges it into main (or discards it), then deletes the worktree.
- **Worktree branches are local and short-lived.** Never push them unless the user explicitly asks. Only main gets pushed.
- Merge one worktree at a time. Rebase a stale worktree onto main before merging if main moved.
## Creating and removing
```bash
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
```
Note: a branch can only be checked out in ONE worktree at a time (including main).
In Cursor: start agents in worktrees via the Agents Window, or `/worktree <task>` in a chat. `/apply-worktree` merges the result into your main checkout; `/delete-worktree` discards; `/best-of-n model1,model2 <task>` runs the same task in parallel worktrees, one per model. Cursor auto-deletes older worktrees (default cap 25 per machine), so merge or push results promptly.
## Making the worktree complete
A fresh worktree contains ONLY tracked files. Everything gitignored is missing. An agent dropped into a bare worktree will fail confusingly, so replicate:
1. **Env/secret files** — copy `.env`, `.env.local`, and similar from the primary checkout. Copy, never symlink (an agent editing a symlinked env file would corrupt the original).
2. **Dependencies** — run the install (`npm ci`, `pnpm install`, `uv sync`, `bundle install`). Never symlink `node_modules`; it breaks builds in both checkouts.
3. **Local databases and services** — decide per service:
- Shared server (e.g. one Postgres container): pin the identity so worktrees don't spawn duplicates fighting over the same port. For Docker Compose, set a top-level `name:` in the compose file — otherwise the project name comes from the folder name and every worktree starts its own container on the same port.
- Per-worktree state (e.g. SQLite files): copy or re-seed it.
4. **Ports** — dev servers, test servers, and debuggers bind fixed ports. Either run one at a time across all worktrees, or make the port configurable per worktree.
5. **Generated files and caches** — rebuild in the worktree (`npm run build`, codegen); build output is gitignored and won't be there.
6. **Git hooks** — `core.hooksPath` and `.git/config` are shared across worktrees automatically; verify hook scripts don't assume the primary checkout's path.
## Automate the setup
Codify the checklist so every worktree bootstraps itself. In Cursor, `.cursor/worktrees.json` runs on worktree creation (`$ROOT_WORKTREE_PATH` = the primary checkout):
```json
{
"setup-worktree": [
"npm ci",
"cp $ROOT_WORKTREE_PATH/.env.local .env.local"
]
}
```
Without Cursor, keep a `scripts/setup-worktree.sh` in the repo and run it as the first command in any new worktree. Inside a worktree, the primary checkout's path is:
```bash
dirname "$(git rev-parse --path-format=absolute --git-common-dir)"
```
## Merging back
```bash
# 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
```
Or in Cursor, simply `/apply-worktree` from the agent's chat, review, commit.
## Gotchas
- Gitignored files silently missing is the #1 failure — always bootstrap before the agent starts.
- Disk: each worktree duplicates the working files plus its own `node_modules`. Delete merged worktrees; don't hoard them.
- Long-lived worktrees rot. If a task stalls for days, rebase onto main or restart it.
- Uncommitted work in a deleted worktree is gone. Commit in the worktree early and often; the commits live in the shared repo even after the folder is removed.
- One shared stash list, one shared config, one shared refs namespace — worktrees isolate files, not git state.From tattooinmtl/omni, MIT.
More from tattooinmtl/omni
- 0.552score
corral-launch-agents
tattooinmtl
Launch new CLI coding agents through Corral Design 1, or correctly reopen existing agent sessions inside a Corral-active Herdr repository.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
herdr
tattooinmtl
Operate and coordinate AI agents running inside Herdr in Ghostty.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
launch-subagent
tattooinmtl
Read this BEFORE launching any subagent (Task tool, background agents, parallel agents, best-of-N, delegating work to another agent).
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
design-taste-frontend-v1
tattooinmtl
ARCHIVED, superseded by `design-taste-frontend` (v2), which is the active default for landing pages, portfolios and redesigns.
SkillBFreshness: B★ 1Claude Code +9 - 0.543score
cmux
tattooinmtl
Control the cmux macOS terminal app (CLI + socket API) — cmux workspaces, panes, surfaces, browser automation, notifications, settings, hooks.
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
gpt-review
tattooinmtl
Launch a GPT 5.6 Sol Max subagent to do a deep, neutral senior-developer review of the current work and report its findings back verbatim.
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
fable-review
tattooinmtl
Launch a Fable 5 Max 1M subagent to do a deep, neutral senior-developer review of the current work and report its findings back verbatim.
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
changelog
tattooinmtl
Generate or update CHANGELOG.md from recent git history.
SkillBFreshness: B★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 19, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/tattooinmtl/omni
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.265score
git-worktree
nordeim
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
SkillAFreshness: AClaude Code +9 - 0.263score
git-worktree
nordeim
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
SkillAFreshness: AClaude Code +9 - 0.263score
git-worktree
nordeim
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
SkillAFreshness: AClaude Code +9 - 0.263score
git-worktree
nordeim
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
SkillAFreshness: AClaude Code +9 - 0.263score
git-worktree
nordeim
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
SkillAFreshness: AClaude Code +9 - 0.255score
git-worktree
nordeim
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
SkillBFreshness: B★ 1Claude Code +9 - 0.244score
git-worktree
nordeim
Use git worktrees to run multiple coding agents in parallel on one repo without collisions.
SkillBFreshness: BClaude Code +9
More from tattooinmtl
- 0.552score
corral-launch-agents
tattooinmtl
Launch new CLI coding agents through Corral Design 1, or correctly reopen existing agent sessions inside a Corral-active Herdr repository.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
design-taste-frontend-v1
tattooinmtl
ARCHIVED, superseded by `design-taste-frontend` (v2), which is the active default for landing pages, portfolios and redesigns.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
herdr
tattooinmtl
Operate and coordinate AI agents running inside Herdr in Ghostty.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
launch-subagent
tattooinmtl
Read this BEFORE launching any subagent (Task tool, background agents, parallel agents, best-of-N, delegating work to another agent).
SkillBFreshness: B★ 1Claude Code +9 - 0.543score
cmux
tattooinmtl
Control the cmux macOS terminal app (CLI + socket API) — cmux workspaces, panes, surfaces, browser automation, notifications, settings, hooks.
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
fable-review
tattooinmtl
Launch a Fable 5 Max 1M subagent to do a deep, neutral senior-developer review of the current work and report its findings back verbatim.
SkillBFreshness: B★ 1Claude Code +9
Cite this page
git-worktree skill. Agent Mart. https://agentmart.dev/skills/tattooinmtl-git-worktree (last updated 2026-10-24)