Skip to content

Feature request: support renaming a worktree (directory + branch) in a single operation by -m (-M) flag #184

@tnagatomi

Description

@tnagatomi

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions