Commands.app

git switch

Branching

Switch branches (newer alternative to checkout)

Options & Flags
Available options for this command
-c

Create and switch to new branch

Examples
Common usage examples

Switch to main branch

git switch main

Create and switch to new branch

git switch -c feature-x
Notes
  • Introduced in Git 2.23 as clearer alternative to checkout
Related Commands
You might also find these useful