git checkout -t <remote>/<branchname>

Create and switch to a new branch tracking a remote branch

This command creates a new local branch and sets it to track the specified remote branch. It then switches to the new branch, allowing you to start working on it immediately.

If you omit the -t flag, the new branch will not be set to track the remote branch. -t is a shortcut for the --track flag.

There is also a --no-track flag to ensure the remote branch is not tracked even if the branch.autoSetupMerge configuration variable is true.