1. If you already have a normal Git repository locally, the simplest way to use Git worktree is to start there.
git worktree add ../<new-folder-name> <branch>
You now have a folder for just one branch---an advantage for many cases, e.g.: updating/changing NPM packages, and keeping WIP without committing and fixing a bug for production in a worktree.
2. If you’re doing a fresh clone, you can clone it as a --bare
repository and add worktrees for each branch you’re working on:
git clone --bare <repository> <new-directory-name>
git worktree add <branch>
Each branch will then be a folder in the Git repository folder.
References: