How to Read git worktree list Output
git worktree list prints one line per worktree: its path, the commit it has checked out, and its branch. -v adds the reason behind locked and prunable, and --porcelain gives scripts a stable format.
The Fix
Run it from the main checkout or from any linked worktree. The output is the same:
git worktree list
Git 2.43 prints the main worktree first, then each linked worktree:
/src/repo 1484765 [main]
/src/repo-feature 1484765 [feature]
/src/repo-gone 1484765 [gone] prunable
/src/repo-hotfix 1484765 [hotfix] locked
/src/repo-review 1484765 (detached HEAD)
Each column has one job:
| Column | Meaning |
|---|---|
| Path | The worktree's directory on disk |
| Commit | The abbreviated commit its HEAD points to |
[branch] | The branch checked out there, or (detached HEAD) when there is none |
locked | git worktree prune, move and remove skip it until you run git worktree unlock |
prunable | Its directory is gone, and git worktree prune will drop its record |
Add -v to see why a worktree is locked or prunable:
/src/repo-gone 1484765 [gone]
prunable: gitdir file points to non-existent location
/src/repo-hotfix 1484765 [hotfix]
locked: on external drive
The lock reason is the text you passed to git worktree lock --reason.
Use It in Scripts
The default format is for people to read. --porcelain prints one attribute per line and a blank line between worktrees, and the Git documentation promises it stays stable:
worktree /src/repo-hotfix
HEAD 1484765a6fd7fb36b364cc9a5ee79dcbe83e9dfe
branch refs/heads/hotfix
locked on external drive
worktree /src/repo-review
HEAD 1484765a6fd7fb36b364cc9a5ee79dcbe83e9dfe
detached
Find the directory where a branch is checked out:
git worktree list --porcelain \
| awk '/^worktree /{p=substr($0,10)} $0=="branch refs/heads/feature"{print p}'
/src/repo-feature
Add -z to end each line with a NUL byte instead of a newline. Use it when a worktree path can contain a newline.
Why a Worktree Shows Up as prunable
Git keeps a record for each linked worktree in .git/worktrees/<name>. If you delete the directory with rm -rf, the record stays, and list flags it prunable. Run git worktree prune to drop it, or git worktree remove <path> next time so Git deletes both. Prune or delete a Git worktree shows both commands.
A stale record also keeps its branch reserved. Adding that branch in a new worktree fails until you prune:
fatal: 'gone' is already used by worktree at '/src/repo-gone'
How Treq Handles It
Treq tracks its own workspaces under .treq/workspaces/ instead of Git worktrees. Run treq st from the home repository to list every workspace with its stacked parent, uncommitted changes and commit count. The CLI reference covers the full output.