Create a git worktree for a ticket
create_worktreeCreate isolated git worktrees for ticket branches to work in parallel, reusing existing ones and placing new ones outside the repo to avoid sync corruption.
Instructions
Create (or reuse) an isolated git worktree for a ticket so several tickets can be worked in PARALLEL - each sub-agent edits its own checked-out directory on branch ticket/, sharing one .git object store, never the shared repo working tree. Created at /. IMPORTANT SYNC CAVEAT: worktrees are placed OUTSIDE the code repo by default (sibling directory -worktrees/), configurable via the project config key worktreeDir - under Cowork, a worktree created INSIDE a synced repo mount can corrupt git internals or fail to sync, so this tool REFUSES a worktreeDir inside the repo and never auto-creates worktrees in the repo itself. Reuses an existing worktree at the path; creates branch ticket/ off baseRef (or current HEAD) when absent. Returns the worktree path, branch, and merge-back guidance. Errors clearly when the project has no codeLocation, the path is not a git repo, git is too old (< 2.5), or a non-worktree directory squats the path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticket | Yes | ||
| baseRef | No | Branch/ref to base the new ticket branch on (default: repo HEAD). | |
| project | Yes |