Skip to main content

Switch between git branches. Requires git version 2.23+.Also see git checkout.

# To switch to an existing branch:
git switch <branch_name>

# To create a new branch and switch to it:
git switch --create <branch_name>

# To create a new branch based on an existing commit and switch to it:
git switch --create <branch_name> <commit>

# To switch to a branch and update all submodules to match:
git switch --recurse-submodules <branch_name>

# To switch to a branch and automatically merge the current branch and any uncommitted changes into it:
git switch --merge <branch_name>