JAEN

Git

git switch

SafeSwitch branches (modern)

git switch <branch>

The branch half of checkout: switch, or create-and-switch with -c. File restores moved to git restore.

Examples

  • git switch -c feature/loginCreate and switch

Syntax

git switch [-c] <branch>

Before you run it

Mind uncommitted changes when switching.

Used when you see

Stuck in detached HEAD
2
Create a branch to keep your workgit switch -c rescue branches off right here.
See the whole flow →

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store