Commands.app

git checkout

Branching

Switch branches or restore files

Options & Flags
Available options for this command
-b

Create and switch to new branch

Examples
Common usage examples

Switch to main branch

git checkout main

Create and switch to new branch

git checkout -b feature-x

Discard changes in file

git checkout -- file.txt
Notes
  • Consider using 'git switch' for switching branches
Related Commands
You might also find these useful