---
name: "Git::Raw::Worktree"
section: "3pm"
platform: "linux"
package: "libgit-raw-perl"
version: "0.90+ds-3+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Git::Raw::Worktree"
---

# Git::Raw::Worktree(3pm)

Git worktree class

## NAME

Git::Raw::Worktree - Git worktree class

## VERSION

version 0.90

## DESCRIPTION

A Git::Raw::Worktree represents a git worktree.

**WARNING**: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).

## METHODS

### add( $repo, $name, $path )

Add a new worktree.

### lookup( $repo, $name )

Lookup a worktree.

### name( )

Retrieve the name of the worktree.

### path( )

Retrieve the filesystem path for the worktree.

### repository( )

Open the worktree as a repository. Returns a Git::Raw::Repository object.

### list( $repo )

List all worktress for `$repo`.

### is\_locked( )

Check if the worktree is locked. Returns the reason for locking or a falsy value.

### is\_prunable( \\%prune\_opts )

Check if the worktree can be pruned. Valid fields for th `%prune_opts` hash are:

- •

  "flags"

  Prune flags. Valid values include:

  - •

    "valid"

    Prune the working tree even if working tree is valid.

  - •

    "locked"

    Prune the working tree even if it is locked.

  - •

    "working\_tree"

    Prune checked out working tree.

### lock( $reason )

Lock the worktree with `$reason`.

### unlock( )

Unlock the worktree.

### validate( )

Check if the worktree is valid. A valid worktree requirest both the git data structures inside the linked parent repository and the linked working copy to be present.

### prune( \\%prune\_opts )

Prune the working tree. Pruning the working tree removes the git data structures on disk. See `"is_prunable"` for valid values of `%prune_opts`.

## AUTHOR

Jacques Germishuys \<jacquesg@cpan.org\>

## LICENSE AND COPYRIGHT

Copyright 2018 Jacques Germishuys.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.
