Skip to content

Support filesystem paths in worktree deletion (and switching) #104

@dgrant

Description

@dgrant

Allow git wt -d (and git wt) to accept filesystem paths (relative or absolute), making it more consistent with native git worktree remove which accepts a path to a worktree.

Why?

I found myself passing an absolute path or "." as argument to "-d" many times, because I'm used to git worktree remove which accepts paths. It seems like git wt can support paths safely, although it does make things slightly more complicated.

Examples

git wt ../sibling
git wt /absolute/path
git wt -d .              # delete current worktree
git wt -d ../sibling     # delete sibling worktree  
git wt -d /absolute/path # delete by absolute path

Priority

  1. Branch name
  2. Directory name relative to baseDir
  3. Filesystem path (new)

Existing behavior is preserved - filesystem paths are only used as a fallback.

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