By BluffKing · · Updated
Git Worktree Isolation
Sharing one working directory means different branches still edit the same files. Worktrees give each task its own directory and ports, then land through one merge path.
Two parallel tasks on different branches still edit the same files if they share one working directory: when one session switches branches, another session’s build can read a mix of versions, and uncommitted edits can overwrite each other. A Git worktree gives each task its own working directory, HEAD and index, which is exactly what fixes this.
BluffKing runs scripts/new-session.sh raise-slider fix to create a task branch and worktree from local main. Each worktree starts its own backend and dev server on fresh ports the script assigns, against the same local database, while main keeps its fixed ports; Rust builds use each worktree’s own target cache. After checks and an independent review, scripts/finish-session.sh in the main checkout merges into local main and removes the worktree; it never pushes.
Git objects, branch refs, stash, repository config and hooks are still shared by every worktree. Worktrees do not remove merge conflicts, and they do not isolate the database or the browser; splitting tasks, serializing shared resources and rechecking at landing still matter.