Skip to main content

create_worktree

Function create_worktree 

Source
pub async fn create_worktree(
    repo_path: PathBuf,
    worktree_path: PathBuf,
    branch_name: String,
    start_ref: String,
) -> Result<(), GitError>
Expand description

Re-exported worktree and branch-detection APIs. Creates a git worktree at the specified path with a new branch.

§Arguments

  • repo_path - Path to the git repository root
  • worktree_path - Path where the worktree should be created
  • branch_name - Name of the new branch to create
  • start_ref - Git ref used as the new worktree branch starting point

§Returns

Ok(()) on success, Err(GitError) on failure.

§Errors

Returns GitError::CommandFailed if spawning fails or the worktree command exits with a non-zero status.