Skip to main content

create_worktree

Function create_worktree 

Source
pub fn create_worktree(
    repo_root: &Path,
    branch: &str,
) -> Result<WorktreeCreation, PawError>
Expand description

Creates a git worktree for branch.

If the branch already exists, checks it out in a new worktree. If the branch does not exist, creates it from HEAD with git worktree add -b. Returns both the worktree path and whether the branch was newly created, so the session can track which branches to delete on purge.