Git · Branches and integration

git checkout

The older multi-purpose command for branches and files. Use switch and restore in new workflows.

Syntax
git checkout <branch>

Example

Example
git checkout main
git checkout -- src/app.ts

More in this group

git branch git cherry-pick git merge git merge --abort git switch 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