# Worktrees

Repository.add_worktree(name: str, path: str | bytes[, ref: Reference]) → Worktree

  Create a new worktree for this repository. If ref is specified, no new branch will be created and the provided ref will be checked out instead.

Repository.list_worktrees() → list[str]

  Return a list with all the worktrees of this repository.

Repository.lookup_worktree(name: str) → Worktree

  Lookup a worktree from its name.

class pygit2.Worktree

  Worktree object.

  is_prunable

    Is the worktree prunable with the given set of flags?

  name

    Gets name worktree

  path

    Gets path worktree

  prune(force=False)

    Prune a worktree object.