git checkout / git switch
command
Switch between branches. git switch is the modern command; git checkout also switches branches.
Syntax
git switch <branch> git checkout <branch>
Example
bash
git switch main # switch to main
git switch feature/login # switch to branch
git switch -c feature/new # create and switch
# Legacy (checkout)
git checkout main
git checkout -b feature/new # create and switch