Skip to main content

Syntax

Description

Lists all worktrees associated with the current repository. Shows the branch name and full path for each worktree. This command reads from GWTree’s internal worktree registry (~/.gwtree/worktrees.json) and filters results to only show worktrees for the current repository.

Aliases

  • ls - Short alias for list

Output Format

The output displays each worktree with its branch name and path:

Examples

List all worktrees

Using the short alias

Behavior

  1. Repository Detection - Verifies you’re in a git repository
  2. Registry Lookup - Reads worktree records from ~/.gwtree/worktrees.json
  3. Filtering - Shows only worktrees for the current repo (matched by repo name)
  4. Validation - Only displays worktrees whose paths still exist on disk
  5. Count - Shows total number of worktrees found

When No Worktrees Exist

If no worktrees are found for the current repository:
Output:

Comparison with git worktree list

GWTree’s list command differs from git worktree list:

Exit Codes

  • 0 - Success (worktrees listed or none found)
  • 1 - Error (not in a git repository)