git checkout / switch
Switch branch (use switch):
git switch branch-namegit switch -c new-branch-namegit switch branch-name— Go to that branch.git switch -c new-branch-name— Create that branch and go to it.
Old way (same idea): git checkout branch-name and git checkout -b new-branch-name.
Restore a file (throw away your changes in that file):
git restore filenamegit checkout -- filenameThe file goes back to how it was at the last commit.