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
See the whole flow →Create a branch to keep your workgit switch -c rescue branches off right here.
Related commands
- git switch / checkoutSwitch branch
- git branchBranches
- git restoreRestore files
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