git worktree add ../app-example-2 other-feature
In this case, the git worktree command has three additional arguments:
addindicates want to create a new working tree../app-example-2is the path to the folder where we want to create the working-tree. As we're running from the root-directory, this creates a folder called app-example-2 parallel to the clone folder.other-featureis the name of the branch to check-out in the working tree
git worktree add ../app-example-2 origin/main -b bug-fix
This example creates a new branch, bug-fix from the origin/main branch, and then checks it out at ../app-example-2.
To remove it, run the following from your "main" working tree
git worktree remove ../app-example-2
If you have uncommitted changes in the linked working tree, git will block you from removing it. You can use --force to force the removal, if you're sure you want to lose the uncommitted changes.