git checkout
BranchingSwitch branches or restore files
Options & Flags
Available options for this command
-bCreate and switch to new branch
Examples
Common usage examples
Switch to main branch
git checkout mainCreate and switch to new branch
git checkout -b feature-xDiscard changes in file
git checkout -- file.txtNotes
- Consider using 'git switch' for switching branches
Related Commands
You might also find these useful