Git · Branches and integration

git switch

Creates and switches branches. Prefer it over checkout for branch operations.

Syntax
git switch -c <branch>

Example

Example
git switch -c feature/auth
git switch main

More in this group

git branch git checkout git cherry-pick git merge git merge --abort git worktree Merge conflict markers

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course