Skip to main content

git_worktree_add

Function git_worktree_add 

Source
pub async fn git_worktree_add(
    repo_dir: &Path,
    worktree_path: &Path,
    branch: &str,
    start_point: Option<&str>,
) -> Result<(), SandboxError>
Expand description

Create a git worktree with a new branch. If the branch already exists (e.g. from a previous session), prunes stale worktrees and checks out the existing branch instead of creating a new one. Detects the repo’s configured user and configures the worktree identity.