pub fn remove_worktree(
repo: &Repository,
worktree_path: &Path,
force: bool,
) -> Result<(), GitError>Expand description
Remove a linked worktree using the git CLI.
This removes the worktree directory and its git tracking. The main worktree cannot be removed — attempting to do so returns an error.
§Arguments
repo- The repositoryworktree_path- Path to the worktree to removeforce- If true, pass--forceto allow removal even with uncommitted changes or if the working tree is dirty
§Errors
- If
worktree_pathis the main worktree - If the git CLI command fails