The dispatch row "Create tracking a remote branch" prescribed `git worktree add <path> <remote>/<branch>`. Per git-worktree(1) the tracking DWIM fires only when <commit-ish> is a bare branch name that is NOT found locally, no -b/-B/--detach is given, and exactly one remote has a matching name; only then is it equivalent to `git worktree add --track -b <branch> <path> <remote>/<branch>`. An explicit <remote>/<branch> is found, so that precondition fails and no branch is created: the result is a detached HEAD with no upstream. Commits made in it become unreachable once the worktree is removed or HEAD moves, and push needs an explicit refspec. Only the -d row was flagged detached. The table now names --track -b as the always-correct form, keeps the bare name shortcut with its precondition stated, and adds a Never row for the <remote>/<branch> spelling. The single-remote and checkout.defaultRemote preconditions move into the body, since a reader who trusts the table never follows the reference pointer. Also corrects `git worktree repair`: the no-argument form is the only cwd-dependent one, and `repair <path>...` runs from any worktree. The claim that running it from the wrong directory "reports nothing and fixes nothing" has no basis in the manual and is removed. Found by an independent review of this branch. Refs #99
git-worktrees
Manage git worktrees to enable multi-branch parallel development across isolated directories.
What it does
This skill handles worktree operations within the git workflow suite. It creates, lists, locks/unlocks, moves, removes, prunes, and repairs worktrees — letting an agent work on multiple branches simultaneously without stashing. It returns structured results (paths, branches, lock status) suitable for agent composition. For multi-step flows spanning branch strategy plus worktree setup, git-workflow handles the broader orchestration and delegates the worktree mechanics here.
Usage
/git-worktrees
Describe your worktree task: create a worktree for a branch, list existing worktrees, lock one for removable media, move, remove, prune, or repair. The skill will handle the operation with appropriate safety checks and return results.
Files
| File | Purpose |
|---|---|
SKILL.md |
Dispatch table, per-operation gates, and the report format |
references/README.md |
Describes the references directory contents |
references/worktrees.md |
Read when an operation needs more than the dispatch table: shared vs. per-worktree state, the add command forms, the full add flag table, orphan branches, sparse-checkout, removable-media locking, remote disambiguation, where to run repair from, config keys, and the emergency-fix and PR-review patterns |
references/sources.md |
Research sources and provenance |