10.5. git worktree#
Work on different branches in separate directories without switching your current working tree.
From a repository with a main branch, create a new branch feature-x in another directory:
git worktree add -b feature-x ../my-project-feature main
git worktree list
The worktrees share the repository’s objects and branches, but each has its own working files, staging area (index), and HEAD.