git checkout

Switch branches or restore files

medium risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
Safer / dry-run alternatives
git stash push -uStash first
git switch <branch>Use switch for branches
git restore --staged <file>Use restore for files
What it does

Older multi-purpose command; prefer git switch / git restore.

Common flags
FlagMeaning
-bCreate and switch
--Restore paths from index⚠ Discards unstaged changes.
Examples
git checkout -b feature/xNew branch · explain & risk-check →
git checkout -- file.txtDiscard changes in a file · explain & risk-check →
Related
git switch git restore
Open the full explainer →More in Git

Reference text is hand-written and may be incomplete — check man git for your version. Test destructive commands on a non-production system first.