-
Useful when working on multiple branches, to avoid stash/pop unmerged paths confusion and work without disturbing other branches. Parallel branches ftw!
-
Having multiple folders for each branch makes things easy for IDEs, compared to restructuring same folder multiple times
-
IMPORTANT! Do not use with submodules
-
Not essential but a better workflow is to start off with a bare repository and have one folder each for each branch:
mkdir <repo>; cd <repo>
git clone --bare <remote>
mv <repo>.git .git
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
git worktree add <branch>
-
Worktree commands help: git worktree help