Skip to content

Cannot remove detached head worktrees #1661

Description

@mjakl

I have a few weird worktrees, they show up like this in the switch TUI:

+ -                    ⚑              ⋯        ⋯        ⋯  ../../../../tmp/remy-pre-ah95aa     92d4121c  ⋯     ⋯
+ -                    ⚑              ⋯        ⋯        ⋯  ../../../../tmp/remy-nodejs-0bNNXy  d36377b1  ⋯     ⋯
+ -                    ⚑              ⋯        ⋯        ⋯  ../../../../tmp/remy-b1497dc        b1497dcf  ⋯     ⋯

I can also list them using wt list --branches.

When I try to remove them in the switch TUI (pressing Alt+r), the switch TUI exits with this message, but does not remove the worktree:

✗ No branch named (detached)

It took me a while to figure out that git worktree prune is the way out of this misery, but I was hoping I could do something similar with worktrunk, that being said, I think that worktrunk simply exits is a bug. Whether or not to add a prune function to the switch TUI is a product decision (at least hinting at git worktree prune would surely help lost souls like me).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions