git checkout another branch work tree code example
Example 1: git worktree prune
$ mkdir a
$ cd a
$ git init
$ git commit --allow-empty --allow-empty-message -m ''
$ git worktree add ../b
$ ls .git/worktrees/
b
$ rm -rf ../b
$ git worktree prune
$ ls .git/worktrees/
$
Example 2: git create worktree
git worktree add ../new-worktree-dir some-existing-branch