Dmytro Morar
Git

Checkout vs switch

git switch is a modern alternative to some of the functions of git checkout, designed for clarity.

  • git checkout — a universal command: it can switch branches and restore files.
  • git switch — only for switching branches (git switch feature/login).
  • git restore — for restoring files (git restore index.js).

Thus, Git divided the checkout behavior to increase readability and safety.