Remove worktrees from interactive switch list
I'd love to be able to clean up work trees from the interactive wt switch menu. Right now, a "remove" option doesn't exist for the selected worktree.
I imagine if you remove the worktree you're in, it would cd me back to the main repo directory, and there would need to be a confirmation.
I can see how this would overload the concept of switching. My first attempt was to look for an "interactive list" experience, where I can browse, create/remove etc. But that doesn't exist, and the interactive switch experience quite fleshed out.
Thanks for the suggestion! This feature actually already exists — the interactive wt switch picker supports Alt-r to remove the selected worktree in-place. The item disappears from the list immediately and the removal runs in the background.
However, this keybinding was missing from the documented keybinding table, which is likely why it wasn't discoverable. I've opened #1869 to add it to the docs.
Note: there's also a known issue (#1695) where the cursor resets to the top of the list after each Alt-r removal, which a maintainer may want to address separately.
A maintainer will review the docs fix shortly.
thanks bot. it would be very helpful to also add it to the list of commands in the TUI of the interactive switch
Great idea — I've pushed a commit to #1869 that adds alt-r: remove to the in-picker controls bar, so it'll show up right next to the other keybindings.
unfortunately the framework we use for the interactive picker — https://github.com/skim-rs/skim — doesn't support a good enough experience for us to document this. Specifically, removing a branch causes the selector to move back to the top; there is no way to control the position of the selector.
it's still useful to some, so I don't have plans to remove the feature — IYKYK
I think their newer version may allow this, but that is not usable yet, since the dependencies are all pinned. If anyone wants this feature, engaging with skim (respectfully) over what features are planned, would be welcome
@worktrunk-bot can we close that PR and instead open something that clarifies the current state / why it's not documented.
Done — #1869 was already closed, and I've opened #1881 to track why Alt-r is intentionally undocumented (skim cursor-reset limitation, link to #1695, what would unblock documenting it).