Skip to content
WorktreeWise
#git#troubleshooting#git-repair#worktree

Worktree was moved manually

W

WorktreeWise Engineering Team

Updated Sep 2026•6 min read
⚡

TL;DR: The 30-Second Summary

Moving a worktree folder using File Explorer, Finder, or `mv` breaks the two-way link between the worktree's `.git` file and `.git/worktrees/<name>/gitdir`. Fix it instantly by running `git worktree repair <new-path>` from your main repository.

The Real-Life Scenario

“Lina tidies up her workspace by dragging `feature-search` into a new `archive/` subfolder. When she opens the folder in terminal, Git refuses to run commands: `fatal: not a git repository`. In the main repo, `git worktree list` reports the old path as missing.”

Git worktrees rely on a strict bidirectional pointer system. The worktree contains a `.git` file storing the absolute path to the main repository, while the main repository stores the absolute path to the worktree directory. If you move a worktree folder with your OS file manager, both paths break.

The Broken Two-Way Link

When a folder is moved without `git worktree move`, the worktree cannot find the main object store, and the main repo marks the worktree as missing or prunable.

What you see in the terminal:

terminal output
$ cd /projects/archive/feature-search
$ git status
fatal: not a git repository (or any of the parent directories): .git

$ cd /projects/main
$ git worktree list
/projects/main             04e3a1f [main]
/projects/feature-search   7b19dc2 [feature-search] (prunable)
🔍

Under the Hood: Git Plumbing & Architecture

Git 2.30 introduced `git worktree repair` specifically to fix this scenario. The repair command reads the worktree's `.git` file, computes the new relative or absolute path, and updates both `.git` and `.git/worktrees/<name>/gitdir` simultaneously.

Quick Command Recipes

Copy and adapt these commands directly in your terminal:

The correct way to move a worktree

Moves the directory on disk and updates all Git internal metadata pointers atomically.

bash
git worktree move ../old-path ../new-path

Fix after manual move

Re-links the moved worktree with the main repository.

bash
git worktree repair ../archive/feature-search
TUTORIAL

Step-by-Step Practical Walkthrough

Follow these verified steps to safely resolve the issue and guarantee that your filesystem and Git references are in sync.

1

Navigate to the main repository

Always run the repair command from the primary checkout where the full `.git/` folder exists.

terminal
cd /projects/main
2

Run git worktree repair pointing to the new location

Pass the new path of the moved worktree to repair.

terminal
git worktree repair /projects/archive/feature-search
Expected Output:
repair worktree: /projects/archive/feature-search
3

Verify the new worktree path is recognized

Run `git worktree list` to confirm that the new path is active and no longer marked prunable.

terminal
git worktree list
Expected Output:
/projects/main                     04e3a1f [main]
/projects/archive/feature-search   7b19dc2 [feature-search]
4

Test Git commands inside the moved directory

Confirm that git status and git log work smoothly inside the moved folder.

terminal
git -C /projects/archive/feature-search status
Expected Output:
On branch feature-search
nothing to commit, working tree clean

Edge Cases & Advanced Scenarios

Both the main repo AND the worktree were moved

If you moved the entire parent folder containing both directories, run `git worktree repair` inside the main repo without arguments to re-link all sibling worktrees.

bash
git worktree repair
⚠️

Common Mistakes to Avoid

❌ Mistake: Running `git worktree prune` before repairing the moved folder

Why it causes trouble: Prune deletes the administrative metadata, severing the link permanently.

What to do instead: Always run `git worktree repair` BEFORE running `git worktree prune`.

✓

Verification Checklist

  • ✓`git worktree list` shows the new folder path without `(prunable)` tags
  • ✓`cat /new-path/.git` points to the valid `.git/worktrees/<id>` path
💡

Senior Engineering Tips

  • ★In WorktreeWise, you can simply rename or relocate worktrees through the UI, and all Git pointers are updated automatically without manual terminal repairs.

Key Takeaways

  • 01.Manual directory moves break Git's two-way pointer system.
  • 02.Use `git worktree move` whenever possible.
  • 03.If you already moved it manually, run `git worktree repair <new-path>` to fix it in one second.
TOOL

How WorktreeWise Solves This Visually

WorktreeWise eliminates the manual friction and mental overhead of CLI flags. It displays real-time branch states, uncommitted modifications, active terminals, and lock statuses across all worktrees on a single visual dashboard.

WorktreeWise Move Worktree interface updating paths safely
WorktreeWise Move Worktree interface updating paths safely
W

WorktreeWise Engineering Publication

Written and curated by the core WorktreeWise team. We build developer tools that turn Git worktrees, workflows, and parallel AI coding agents into second nature.

Related Troubleshooting Guides

View all troubleshooting →