-
Notifications
You must be signed in to change notification settings - Fork 77
Description
Problem
gtr clean --merged fails silently when worktrees contain submodules, because the underlying git worktree remove refuses to remove worktrees with submodules:
==> Removing worktree: my-feature
[x] Failed to remove worktree: fatal: working trees containing submodules cannot be moved or removed
This affects any repo that uses git submodules — all worktrees will fail to clean up, making gtr clean --merged essentially unusable in those repos.
Current behaviour
gtr rm already supports --force to bypass this (and the uncommitted-changes check). However, gtr clean has no equivalent flag, so there's no way to clean up merged worktrees in repos with submodules without resorting to manual rm -rf + git worktree prune.
Requested change
Add a --force flag to gtr clean that passes through to the underlying git worktree remove --force call, consistent with how gtr rm --force works.
gtr clean --merged --yes --forceWorkaround
Currently the only option is manually removing each worktree directory and running git worktree prune, which loses the merge-detection and other benefits of gtr clean.