Summary
Add a way to rename a worktree managed by git-wt, both the directory and the associated branch in a single operation, analogous to git branch -m / -M.
Motivation
Renaming a git-wt worktree currently requires several manual steps: git branch -m, git worktree move, cleaning up empty parent directories (notably when branch names contain /), and re-cd-ing if inside the renamed worktree. Rename feels like a natural completion of the existing create / switch / delete vocabulary.
Typical use cases: fixing typos, renaming as scope evolves, reorganizing naming conventions.
Considerations worth weighing
- Argument shape vs.
git branch -m conventions (implicit current vs. explicit old/new)
- Detached HEAD worktrees (no branch to rename)
- Mismatched directory/branch names and branches containing
/ (empty parent directory cleanup)
- Default branch protection, consistent with
--allow-delete-default
- Conflicts: existing target branch/directory, dirty worktree, and whether a force variant is exposed
- Shell integration:
cd behavior when renaming the current worktree, interaction with wt.nocd
- Whether
wt.hook should fire on rename
Summary
Add a way to rename a worktree managed by git-wt, both the directory and the associated branch in a single operation, analogous to
git branch -m/-M.Motivation
Renaming a git-wt worktree currently requires several manual steps:
git branch -m,git worktree move, cleaning up empty parent directories (notably when branch names contain/), and re-cd-ing if inside the renamed worktree. Rename feels like a natural completion of the existing create / switch / delete vocabulary.Typical use cases: fixing typos, renaming as scope evolves, reorganizing naming conventions.
Considerations worth weighing
git branch -mconventions (implicit current vs. explicit old/new)/(empty parent directory cleanup)--allow-delete-defaultcdbehavior when renaming the current worktree, interaction withwt.nocdwt.hookshould fire on rename