Hasty Briefsbeta

Git-worktree – Manage multiple working trees

4 days ago
  • #worktree
  • #git
  • #version-control
  • Git worktree allows managing multiple working trees attached to the same repository.
  • A repository has one main worktree and zero or more linked worktrees.
  • Commands include add, list, lock, move, prune, remove, repair, and unlock.
  • Each linked worktree has a private sub-directory in the repository's $GIT_DIR/worktrees.
  • Worktrees can be locked to prevent automatic pruning, useful for portable devices.
  • The porcelain format provides a detailed, script-friendly output for worktree listings.
  • Worktree-specific configuration can be enabled via extensions.worktreeConfig.
  • Examples include creating temporary worktrees for emergency fixes without disturbing the main worktree.