Check out an existing branch in a new worktree
basics
// what it does
Creates a new directory at ../myapp-hotfix with the hotfix branch checked out, while your current checkout stays untouched. Both directories are working trees of the same repository — they share history, objects, remotes, and config, so the new worktree appears instantly with no cloning and no network traffic.
// shell
$ git worktree add ../myapp-hotfix hotfix$ git worktree list// gotcha
Git refuses if hotfix is already checked out in another worktree ("fatal: 'hotfix' is already checked out at ..."). The safeguard exists because committing in one checkout would silently desync the other — use a different branch, or a detached worktree (-d) if you only need the files.