Day 60 of 62 · Friday · Learning

Worktrees - three versions of an idea, zero collisionsHands-on

A git worktree is a second working copy of the same repo, on its own branch, in its own folder — so you can build three versions of an idea side by side and never let a half-finished experiment touch main.

Catch-up progress
60/62
Why this matters to you

Your whole posture is 'test build ideas cheaply, learn fast, keep what shows signal.' Worktrees are the isolation primitive that makes cheap parallel prototyping actually safe — and they're the clean answer to Tuesday's two-Claudes-share-one-tree hazard: give each session its own worktree and they physically cannot clobber each other.

Normally a repo has one working directory, and switching branches swaps the files under you — which means you can't have branch A and branch B open at once. A worktree breaks that limit: `git worktree add` creates a SECOND folder checked out to a different branch, sharing the same underlying history. Two folders, two branches, one repo. Build variant-A of a landing page in one, variant-B in the other, compare them running at the same time, keep the winner, delete the rest — and main never saw either experiment.

For parallel work this is the difference between safe and reckless. Tuesday's lesson was about two Claude sessions fighting over one working tree; the real fix isn't 'be careful,' it's 'stop sharing the tree.' Point session one at the main checkout and session two at a worktree and there is no shared file to clobber — each has its own copy, and git reconciles them at merge time, which is exactly what git is for.

It's wired into your tooling. The superpowers:using-git-worktrees skill carries the discipline for spinning them up and tearing them down; and some agents can be launched with isolation:'worktree' so they automatically get a scratch copy of the repo that's cleaned up if they didn't change anything. The mental model to keep: a worktree is disposable scratch space with full git power — cheap to create, cheap to throw away, and it keeps your experiments off the branch you actually ship.

Worked example

Create one, prove it doesn't touch the original, tear it down — all safe.

cd /Users/tom/Claude/PDB/output   # any project repo
git worktree add ../scratch-experiment -b scratch-experiment
echo 'throwaway' > ../scratch-experiment/EXPERIMENT.txt
git -C . status --short              # ← the ORIGINAL folder: still clean
git worktree list                    # both trees, each on its own branch
git worktree remove ../scratch-experiment --force
▶ Do it now
  1. Pick any project repo and run the `git worktree add` above with a throwaway branch name.
  2. Make an edit inside the new folder, then run `git status` in the ORIGINAL folder and confirm it reports clean — that's the isolation, seen with your own eyes.
  3. Run `git worktree remove` to clean up, then `git worktree list` to confirm you're back to one tree — you've now got the full create-use-destroy loop.

Gotchas

Go deeper: git worktree — official docs
One-card takeaway

A worktree is a disposable second checkout with full git power — the cheapest way to run experiments (or two Claudes) in parallel without ever risking the branch you ship.