Skip to main content

list_worktrees

Function list_worktrees 

Source
pub fn list_worktrees() -> Result<Vec<WorktreeInfo>>
Expand description

List all worktrees for the current repository.

Returns information about each worktree including path, branch, and commit. The main repository is always included in the list with is_main: true.

ยงReturns

  • Ok(Vec<WorktreeInfo>) - List of worktrees (always has at least one - the main repo)
  • Err - If not in a git repository or git command fails