Reference

Git Worktree Field Guide

A printable command map for working on several branches at once without losing the state of an unfinished task.

Course: Git Worktrees for Parallel CodingPrimary source: official Git worktree manualLast checked: 2026-07-23

Core model

StateShared?Practical consequence
Objects, commits, most refsYesA commit in any worktree is visible everywhere.
Files, index, HEADNoEach worktree has its own edits, staging area, and checkout.
One branch checked out twiceBlocked by defaultUse a distinct task branch or find the existing worktree.
Clean worktree removalRequired by defaultInspect before force or deletion.

Normal workflow

Listgit worktree list -vCreatebranch plus pathInspectstatus, diff, logCommitpreserve the taskIntegrateverify targetRemoveclean path

Command map

CommandUse when
git worktree list --verboseFind every attached path, branch, lock, or prune state.
git worktree add -b fix/login ../repo-loginCreate a new task branch and sibling worktree.
git worktree add ../repo-review review/123Open an existing branch that is not checked out elsewhere.
git worktree add --detach ../repo-scratchMake a branchless experiment or test checkout.
git status --shortFind tracked and untracked work before cleanup.
git diff / git diff --cachedRead unstaged and staged changes separately.
git log --oneline main..HEADInspect task commits not yet in the target.
git merge branchIntegrate the whole completed task branch.
git cherry-pick <commit>Integrate one selected commit.
git worktree remove ../repo-loginRemove a clean linked worktree and its metadata.
git worktree move <old> <new>Relocate a worktree while keeping it connected.
git worktree repair <new-path>Reconnect a worktree moved manually.
git worktree prune --dry-runPreview stale records after a path disappeared.
git worktree lock --reason "..." <path>Protect a temporarily unavailable worktree from pruning.

Before integration

  • Commit the task worktree's changes.
  • Read the task commit range.
  • Choose merge or cherry-pick explicitly.
  • Ensure the target worktree is clean.
  • Run checks in the target after integration.

Before removal

  • Run git status --short.
  • Confirm useful commits are integrated or preserved.
  • Use git worktree remove.
  • Delete the branch only after it is no longer needed.
  • Run git worktree list --verbose again.

Red flags

You seeMeaningResponse
Branch already checked outAnother worktree owns that checkout.Find it or make a new task branch; do not force by default.
Removal refuses dirty worktreeTracked or untracked work is present.Inspect, preserve, or explicitly discard it.
Prunable entryGit cannot find a recorded path.Preview prune; use repair if the path moved.
Worktree moved manuallyFilesystem and Git metadata disagree.Run git worktree repair at the new path.
Need different local configShared config may affect every checkout.Learn extensions.worktreeConfig before using git config --worktree.