Work on a second branch with a worktree¶
Use a worktree when a task needs another branch checked out without disturbing the current checkout. For a clean checkout and a single new branch, a normal branch switch is simpler.
Execution status
CI does not create or remove worktrees in a contributor's workspace. Run these commands manually after the status check, and rely on the script's safety refusal rather than forcing removal of unresolved work.
Add a worktree¶
The default destination is
repos/.worktrees/<repo>/<branch-slug>/. It is ignored by Spine discovery and
agent sync. For sibling repository layout, pass --sibling before the command:
Keep the current Spine session for cross-repository context and direct file operations to the returned path.
List and remove worktrees¶
scripts/worktree.sh list LANfactory
scripts/worktree.sh rm LANfactory codex/example-change
scripts/worktree.sh prune
Removal refuses a worktree Git considers unsafe to remove. Commit or otherwise resolve intended work first; do not use destructive Git cleanup as a shortcut.
Before adding or removing anything, inspect the workspace with the status procedure.