Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Created May 25, 2026 20:20
Show Gist options
  • Select an option

  • Save copyleftdev/96517bb812660ae512d4530691ff385b to your computer and use it in GitHub Desktop.

Select an option

Save copyleftdev/96517bb812660ae512d4530691ff385b to your computer and use it in GitHub Desktop.
git worktree — multiple checkouts, one repo
# git worktree — multiple checkouts, one repo
# Run two branches side-by-side without stashing or switching.
git worktree add ../feature-branch feature/my-feature
git worktree add ../hotfix-branch main
# Both share the same .git — no second clone needed.
# List all active worktrees:
git worktree list
# Clean up when done:
git worktree remove ../hotfix-branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment