Skip to main content

create_worktree

Function create_worktree 

Source
pub fn create_worktree(
    bare: &Path,
    dest: &Path,
    branch: &str,
    base_branch: &str,
    branch_exists: bool,
) -> Result<()>
Expand description

Create a worktree inside a bare clone.

When branch_exists is false a new branch is created from origin/<base_branch>. When branch_exists is true the existing branch is checked out.

ยงErrors

Returns an error if the git command fails to spawn or exits non-zero.