pub fn add_worktree(
repo: &Repository,
branch_name: &str,
branch_type: BranchType,
base_branch: Option<&str>,
) -> Result<WorktreeDescriptor>Expand description
Create a new worktree for the given branch.
The worktree directory is placed under the workon root (see workon_root).
Branch names containing / are supported; parent directories are created
automatically and the worktree is named after the final path component.
ยงBranch types
BranchType::Normalโ uses an existing local/remote branch, or creates one frombase_branch(or HEAD ifbase_branchisNone).BranchType::Orphanโ creates an independent branch with no shared history, seeded with an empty initial commit.BranchType::Detachedโ creates a worktree with a detached HEAD pointing to the current HEAD commit.