using-git-worktrees
Installation
SKILL.md
Using Git Worktrees
Discover the layout
Run scripts/discover-worktree-layout.sh once from the initial cwd to discover the layout:
worktree: use the reportedworktree; starting there means the user already selected that checkout, so do not create another for the same target. Create another only when the task requires a different revision and no suitable checkout exists.single-container: use the sole reportedrepository.mixed-container: select the reportedrepositorythat matches the task.- Nonzero exit: the target is not a recognized Git workspace. Stop, unless the task is to set up a new container there.
Finish discovery before recursive file searches, and scope them to the selected checkout rather than the worktree container.
workspace is the shared .agents root and is always reported. container is where checkouts live and is reported for bare repositories. They differ when the container is nested, as in project/{.agents,worktrees/{.bare,main,…}}. Values are resolved from any starting depth, including inside a checkout, so use reported values rather than deriving them from cwd.