git checkout <branchname>

Switch to a different branch

This command allows you to switch to a different branch in your Git repository.

It updates the working directory and the index to match the contents of the specified branch. By providing the branch name as an argument, you can easily change to that branch.

If you want to create a new branch and switch to it at the same time, you can use the flag -b flag. Additionally, you can use the flag -t or --track to set up a tracking branch.

Specific examples:
git checkout main

Sign in to enable bookmarking, reminders, progress-tracking and more...