Summary
Add a way to replace git worktree remove with a custom command (e.g. trash, trash-put) for faster worktree deletion.
Motivation
rm -rf (used internally by git worktree remove) can be slow for large worktrees. Tools like trash-cli move directories to the system trash instantly, which is significantly faster.
Proposed Design
- New config key
wt.remover and CLI flag --remover
- When set, the specified command is used instead of
git worktree remove, with the worktree path passed as an argument
- After the custom command completes, run
git worktree prune to clean up git's internal worktree registration
Example usage
# Persistent via git config
git config wt.remover "trash"
# One-off via flag
git wt -D --remover "trash-put" my-branch
Notes
Summary
Add a way to replace
git worktree removewith a custom command (e.g.trash,trash-put) for faster worktree deletion.Motivation
rm -rf(used internally bygit worktree remove) can be slow for large worktrees. Tools liketrash-climove directories to the system trash instantly, which is significantly faster.Proposed Design
wt.removerand CLI flag--removergit worktree remove, with the worktree path passed as an argumentgit worktree pruneto clean up git's internal worktree registrationExample usage
Notes
wt.deletehook(feat: addwt.deletehookconfig and--deletehookflag #132), which runs commands before the standard removal and is intended for cleanup tasks (e.g. deleting remote branches)