Quick Actions
git checkout
Description
Switch branches or restore working tree files.
Command
git checkout
Examples
Switch to branch
git checkout main
Create and switch to new branch
git checkout -b feature-branch
Restore file
git checkout -- filename.txt
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
-b <branch> |
string | No | Create and switch to new branch |
-B <branch> |
string | No | Create/reset and switch to branch |
--track |
string | No | Set up tracking mode |
--orphan |
string | No | Create orphan branch |
Command Info
Category:
Branching
Type:
Git
Views:
7
Status:
Active
Tags
branch
switch
restore