git-worktrees

Installation
SKILL.md

Git Worktrees

Second (and third, …) working directories linked to the same .git object store. One repo, many checkouts. Shared history, objects, refs, hooks, LFS — no re-clone.

Commands

git worktree add ../hotfix hotfix-branch        # existing branch
git worktree add -b new-branch ../new main      # create from main
git worktree add --detach ../inspect <sha>      # for read-only review
git worktree list [--porcelain]
git worktree lock ../critical                   # prevent prune
git worktree move ../old ../new
git worktree remove ../hotfix                   # after cd out
git worktree prune                              # clean stale metadata
git worktree repair                             # fix links after moves

Rules

Installs
22
First Seen
Apr 18, 2026