Skip to main content

remove_worktree

Function remove_worktree 

Source
pub async fn remove_worktree(worktree_path: PathBuf) -> Result<(), GitError>
Expand description

Re-exported worktree and branch-detection APIs. Removes a git worktree at the specified path.

Uses –force to remove even with uncommitted changes. Finds the main repository by comparing git-dir and git-common-dir.

§Arguments

  • worktree_path - Path to the worktree to remove

§Returns

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

§Errors

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