- Worktrees go under
worktrees/in the main checkout, never inside other worktrees. Git ignores that directory (git check-ignore -q worktrees/succeeds from the main checkout). - A new worktree starts from the latest
main, unless the work was asked to start from a particular branch or commit: fetch, then rebase onto whichever of localmainandorigin/mainis ahead. - Run
pnpm installin the worktree before running any of its scripts. Package managers hoist dependencies inconsistently, so what is installed in the main checkout may not resolve from a worktree. - Copy
.dev.varsfrom the main checkout into the worktree before runningpnpm dev. It is gitignored, so a new worktree doesn't have it, and the app needs it to reach Sanity. - Do all the work in the worktree, never in the main checkout.