Skip to Content
Managing Git WorktreesRename a Worktree

Rename a Git Worktree

Renaming a worktree in WorktreeWise updates the filesystem directory name and runs git branch -m to keep your Git branch name and directory structure synchronized.


Rename a Worktree

  1. In the Worktrees panel, locate the worktree you want to rename.
  2. Select the three-dot Actions menu and choose Rename.
  3. In the dialog, enter the new name for the worktree and branch (e.g. feature-payment-v2).
  4. Select Rename.

Rename dialog with a meaningful new name


Automatic Branch Synchronization

In standard Git CLI, renaming a worktree folder does not rename the branch, and running git branch -m does not rename the folder on disk. This often leads to discrepancies where a directory named feature-v1 is checked out to feature-v2.

WorktreeWise performs both updates atomically:

  1. Branch Renamed: Executes git branch -m <old-name> <new-name>, preserving all commit history and reflog records.
  2. Directory Renamed: Renames the worktree directory on disk to match your configured naming template.
  3. Pointers Re-anchored: Updates Git’s administrative link files (.git in the worktree and gitdir in the main repository).

Renaming updates your local Git branch. If you have already pushed the old branch to a remote repository, push the newly renamed branch and delete the old remote branch if needed:

git push origin -u <new-branch> git push origin --delete <old-branch>

Validation & Restrictions

WorktreeWise validates the new name before executing the rename operation:

RuleRequirement
Git Ref SyntaxMust adhere to standard Git branch naming rules (no whitespace, control characters, tildes ~, colons :, carets ^, or consecutive periods ..).
Collision PreventionThe new name must not conflict with an existing local branch or existing directory.
Primary Worktree ImmunityThe primary repository worktree cannot be renamed from this menu.
Lock ProtectionLocked worktrees cannot be renamed until explicitly unlocked.