Skip to main content

Module worktree

Module worktree 

Source

Functions§

add_worktree
Add a permanent worktree for the given branch at wt_path. Fetches the branch locally first if needed.
ensure_worktree
Find the worktree for branch or create one under worktrees_base. Returns the canonical worktree path. Idempotent.
find_worktree_for_branch
Find the directory of an existing permanent worktree for the given branch. Returns None if no such worktree is registered, if the matching worktree is the main worktree, or if the branch does not start with “ticket/”.
list_ticket_worktrees
List all permanent worktrees for ticket/* branches. Returns (worktree_path, branch_name) pairs, skipping the main worktree.
list_worktrees_with_tickets
provision_worktree
remove_worktree
Remove a permanent worktree.
sync_agent_dirs
Copy agent config directories from the main repo into a worktree. Only copies directories that are NOT tracked by git (untracked/gitignored).