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 on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store