git-checkout
Check out a branch or paths to the working tree. tldr-pages
On several platforms
Several platforms
Create and switch to a new branch
git checkout -b branch_nameIdentifyCreate and switch to a new branch based on a specific reference (branch, remote/branch, tag are examples of valid references)
git checkout -b branch_name referenceIdentifySwitch to an existing local branch
git checkout branch_nameIdentifySwitch to the previously checked out branch
git checkout -IdentifySwitch to an existing remote branch
git checkout --track remote_name/branch_nameIdentifyDiscard all unstaged changes in the current directory (see git reset for more undo-like commands)
git checkout .IdentifyDiscard unstaged changes to a given file
git checkout path/to/fileIdentifyReplace a file in the current directory with the version of it committed in a given branch
git checkout branch_name -- path/to/fileIdentify