Skip to main content

create_worktree

Function create_worktree 

Source
pub fn create_worktree(spec_id: &str, branch: &str) -> Result<PathBuf>
Expand description

Creates a new git worktree for the given spec.

§Arguments

  • spec_id - The specification ID (used to create unique worktree paths)
  • branch - The branch name to create in the worktree

§Returns

The absolute path to the created worktree directory.

§Errors

Returns an error if:

  • The branch already exists
  • Git worktree creation fails (e.g., corrupted repo)
  • Directory creation fails