git worktree move: Relocate a Worktree
The git worktree move command relocates a linked worktree to a new directory path. It updates all of Git's internal bookkeeping so that the worktree remains properly linked to the main repository at its new location.
Basic Syntax
git worktree move <worktree> <new-path>The worktree argument is the current path to the linked worktree you want to move. The new-path is the destination directory. The destination must not already exist — Git will create it as part of the move.
# Move the worktree from ../feature to ../features/auth
git worktree move ../feature ../features/authAfter the move, the worktree continues to track the same branch and retains all uncommitted changes. The old directory is removed automatically.
When to Use Move
The most common reasons to move a worktree:
- Reorganizing your directory structure— you want to group worktrees under a common parent directory (e.g.,
~/worktrees/project/) instead of having them scattered across your filesystem. - Renaming a worktree directory— you chose a poor directory name initially and want a more descriptive one.
- Moving to a different disk or partition— you need more space or want the worktree on an SSD for faster builds.
Important: Do not move a worktree directory manually with mv. This breaks the internal links between the worktree and the main repository. Always use git worktree move.
Examples
Rename a worktree directory
# Rename from a generic name to something descriptive
git worktree move ../wt1 ../feature-payment-gatewayMove into an organized directory structure
# Create a parent directory for all worktrees
mkdir -p ~/worktrees/myproject
# Move existing worktrees into the organized structure
git worktree move ../hotfix ~/worktrees/myproject/hotfix
git worktree move ../feature-auth ~/worktrees/myproject/feature-auth
# Verify the new layout
git worktree listMove a locked worktree
Locked worktrees cannot be moved by default. You must unlock them first, move, then optionally re-lock:
# Unlock, move, then re-lock
git worktree unlock ../feature-locked
git worktree move ../feature-locked ../new-location
git worktree lock ../new-location --reason "On external SSD"Alternatively, use --force to move a locked worktree without unlocking it first:
git worktree move --force ../feature-locked ../new-locationMoving to External Drives
You can move a worktree to an external drive or USB stick. This is useful for working on different machines or keeping a backup copy:
# Move worktree to an external drive (macOS example)
git worktree move ../feature-auth /Volumes/ExternalSSD/worktrees/feature-auth
# Lock it so Git doesn't prune it when the drive is unmounted
git worktree lock /Volumes/ExternalSSD/worktrees/feature-auth \
--reason "Located on external SSD"When the drive is not mounted, Git will see the worktree as missing. Without the lock, git worktree prune would remove the administrative data for it. Locking prevents this. See the git worktree lock tutorial for more details.
Limitations
There are a few restrictions to be aware of:
- The main worktree cannot be moved. The
git worktree movecommand only works with linked (non-main) worktrees. To relocate the main worktree, you must move the entire repository directory. - The destination must not exist. Git will not overwrite an existing directory. If the target path already exists, the command fails.
- Locked worktrees require --force or unlocking. As shown above, you need to either unlock the worktree first or use the
--forceflag.
# Trying to move the main worktree fails
$ git worktree move . ../new-main
fatal: cannot move a bare repository or the main working tree
# Trying to move to an existing directory fails
$ git worktree move ../feature ../existing-dir
fatal: '../existing-dir' already exists