Worktrees in Git
Ever want to have multiple branches of the same repository checked out at the same time? One option is to clone the repository multiple times. But Git worktrees allow multiple working trees to be attached to the same repository. This can be simpler to use and save storage space.
From inside an existing repository run the following to create a new worktree:
git worktree add /path/to/new/checkout other-branch
other-branch
is now checked out at /path/to/new/checkout
. You can work in that directory just as you can the original.
To remove the worktree when you are done:
git worktree remove /path/to/new/checkout