Create a worktree from a remote branch
basics
// what it does
If feature-x doesn't exist locally but exists on exactly one remote, git worktree add ../feature-x feature-x automatically creates a local tracking branch from origin/feature-x and checks it out — the fastest way to review a colleague's (or an agent's) pushed branch. --guess-remote applies the same matching when you give only a path; set worktree.guessRemote true to make that the default.
// shell
$ git fetch origin$ git worktree add ../feature-x feature-x$ git worktree add --guess-remote ../feature-x// gotcha
Matching works against remote-tracking refs you already have, so run git fetch first or the branch won't be found. If the same name exists on several remotes, disambiguate with checkout.defaultRemote=origin.