git checkout
Switch branches or restore files
BranchingSyntax
git checkout <branch|file>
Examples
git checkout main— checkout maingit checkout -b new-feature— checkout -b new-featuregit checkout -- file.txt— checkout -- file.txt
Common flags & options
- •-b name Create and switch
- •-- file Restore file from index