scan --json
lopper scan --json [path...] prints a JSON array to stdout,
one object per linked worktree in the order lopper found them, or
[] when there are none. Main worktrees are not listed.
Messages for a person go to stderr.
[
{
"path": "/home/me/.agents/wt/fix-login",
"repo": "/home/me/code/app",
"branch": "fix-login",
"safe": true,
"facts": {
"dirty": 0,
"unchecked_files": 0,
"unpushed": 0,
"merged": "content",
"upstream_gone": false,
"last_commit": "2026-10-28T14:03:11Z",
"size_bytes": 482113536
}
},
{
"path": "/tmp/scratch/old-app",
"repo": "/home/me/code/old-app",
"safe": false,
"orphaned": true,
"facts": {
"size_bytes": 1048576
}
}
]
worktree
- path string, always
- The worktree's folder, as an absolute path.
- repo string, always
- The main worktree of the repository it belongs to, or the folder of a bare repository. For an orphaned worktree, where the repository was.
- branch string, omitted if unknown
-
The branch checked out, such as
fix-login. Omitted when HEAD is detached, or when lopper cannot tell, as for an orphaned worktree. - safe boolean, always
-
Whether lopper considers it safe to delete. It is not safe when lopper
could not check for work it holds. A
prunableworktree is safe unless locked, since there is no folder left to lose. - locked boolean, omitted if false
-
Someone ran
git worktree lockon it. A locked worktree is never safe. - prunable boolean, omitted if false
-
The folder is gone and only Git's record of it is left.
git worktree prunein the repository removes the record. - orphaned boolean, omitted if false
- The folder is there, but its repository is gone or no longer lists it.
- moved_from string, omitted unless moved
-
Where Git still expects a worktree that was moved by hand.
git worktree repairin the worktree fixes that. - unconfirmed string, omitted unless unconfirmed
-
Why the repository named in the folder's
.gitfile could not confirm the worktree, such asgitdir is missing from …. - facts object, always
- What lopper found inside the worktree, described below.
facts
Each field is omitted when lopper does not know it: the check failed,
and errors says why, or it did not run. lopper runs no Git
checks on orphaned and prunable worktrees. A count of zero is printed as
0, not omitted.
- dirty integer
-
Entries
git statuslists: changed, staged and untracked. An untracked folder counts once. - unchecked_files integer
-
Files whose assume-unchanged or skip-worktree index flag hides their
edits from
git status. - unpushed integer
- Commits on HEAD that are on no remote branch and not in the base branch, as of the last fetch.
- merged string
-
Whether the work reached the base branch:
origin/HEAD,mainormaster. Also omitted when the repository has none of them.-
"ancestor": HEAD is in the base branch, by a merge or fast-forward. -
"content": the base branch has the same changes, after a squash, rebase or cherry-pick. -
"none": the work is not in the base branch.
-
- upstream_gone boolean
- Whether the branch tracks an upstream branch that no longer exists, such as one deleted on the remote after a merge, as of the last fetch.
- last_commit string
-
Committer date of HEAD in UTC, in RFC 3339, such as
2026-10-28T14:03:11Z. Omitted when lopper could not read it. - size_bytes integer
-
Total size of the regular files in the folder, or
0when the folder is gone. Omitted when lopper could not measure the folder. - errors array of strings
-
One entry per failed check, such as
could not read status: …. Omitted when no check failed.