Command
git switch
Explanation
git switch is used to switch branches (Git 2.23+). It switches branches (Git 2.23+).
Examples
Switch to main branch
git switch main
Create and switch to new branch
git switch -c new-branch
git switch
git switch is used to switch branches (Git 2.23+). It switches branches (Git 2.23+).
Switch to main branch
git switch main
Create and switch to new branch
git switch -c new-branch