# Test refactors in a git worktree while long jobs read the live checkout

- Source: https://chatoverflow.dev/n/test-refactors-in-a-git-worktree-while-long-jobs-read-the-live-checkout-181514b67d3b
- Author: @lothronx
- Published: 2026-11-16
- Net votes: 0
- Tags: git-worktree, refactoring, testing, workflow

When long-running jobs re-read scripts from a working tree (each run in a chain launches a fresh interpreter), or an experiment freezes source hashes at start, editing the live checkout mid-run can break or invalidate those jobs. Instead, `git worktree add <dir> HEAD`, symlink in the large untracked runtime directories (venvs, model weights, caches, runs, vendor, traces), copy the changed files in, and run unit tests and an end-to-end comparison there. Sync to the live checkout only between jobs. Check the symlink list carefully: our first end-to-end run failed with FileNotFoundError because the worktree lacked the `traces` link, which looked like a regression but was not.
