What the notes mean
lopper shows notes next to each worktree, and lopper rm
prints the ones that keep it from removing a worktree. A worktree is
safe to delete only when no note blocks it. Run the commands below in
the worktree unless they say otherwise.
notes that block removal
- locked
-
Someone ran
git worktree lockon it, often a tool that still uses it.git worktree list --porcelainin the repository prints the reason afterlocked.Once nothing uses it:
git worktree unlock <path> - 3 uncommitted
-
git statuslists that many changed, staged or untracked entries. An untracked folder counts once.Commit them, or
git stash -u: the stash belongs to the repository and outlives the worktree. - 2 unchecked
-
That many files have the assume-unchanged or skip-worktree index flag, so
git statusdoes not show their edits.git ls-files -v | grep '^[a-zS]'lists them.git update-index --no-assume-unchanged -- <file>andgit update-index --no-skip-worktree -- <file>clear the flags, andgit statusthen shows the edits. - 1 unpushed
-
That many commits are on no remote branch and not in the base branch, as of your last fetch. lopper shows it only when the work is not merged.
git push, orgit fetchif they were pushed from elsewhere. - not merged
-
The base branch has neither the commits nor their changes. The base is
origin/HEAD,mainormaster.If it was merged on the server,
git fetchbrings that in. If you no longer need the work,lopper rm --force <path>removes the worktree and keeps the branch. - no base branch
-
The repository has no
origin/HEAD,mainormaster, so lopper cannot tell whether the work is merged.git remote set-head origin --autosetsorigin/HEADto the remote's default branch. - couldn't check
-
A Git command failed, so a fact is unknown and counts against the worktree.
lopper scan --jsonlists the errors underfacts.errors, such ascould not read status: ….Run the command the error names,
git statusfor that one, to see Git's whole message, and fix what it reports. - moved by hand
-
The folder was moved without
git worktree move, and Git still expects it where it was.scan --jsonshows that place asmoved_from.git worktree repairin the worktree, orgit worktree repair <path>in the repository, points Git at the new place. - not confirmed by git
-
The folder's
.gitfile names a repository, but the repository's record of the worktree is damaged or it cannot list its worktrees.scan --jsongives the reason asunconfirmed.For
gitdir is missing from …orgitdir is empty in …,git worktree repairin the worktree rewrites it. Forcommondir is missingorHEAD is missing, repair cannot help: copy out what you need, thenlopper rm --force <path>. Forcould not list its worktrees: …, rungit worktree listin the repository and fix the error it prints, such as a broken.git/config. - not tracked by git
-
The folder is still there, but its repository is gone or no longer lists it.
scan --jsonshows it asorphaned, andreposays where the repository was. lopper cannot check such a folder for unsaved work.If you moved the repository,
git worktree repair <path>in its new place links the worktree again. If it is deleted, copy out what you need, thenlopper rm --force <path>.
notes that do not
- merged
-
The work is in the base branch, by a merge or fast-forward, or by a squash, rebase or cherry-pick that left the same changes. Nothing to do.
- folder gone
-
The folder was deleted and only Git's record of it is left, which takes no space.
scan --jsonshows it asprunable.lopper rmleaves it alone.git worktree prunein the repository removes the record. It keeps a locked one untilgit worktree unlock <path>.