FahamLah

Commands

git worktree (add

git worktree (add <path> [-b <branch>] | list | remove <path>)

Risk: Careful

What it does

Opens a second working folder for the same repo.

When to use it

To fix something on another branch without leaving your work.

Example

$ git worktree add ../hotfix -b hotfix

Make folder ../hotfix on a new branch called hotfix.

$ git worktree list

Show every working folder and its branch.

$ git worktree remove ../hotfix

Delete that folder. The branch and its commits stay.