How to switch branches with checkout?

git checkout branch_name

To switch to a branch called branch_name with the checkout command use git checkout branch_name.

Layer 1
Terminal Example
git branch -v
* main        9b3e5ec readme
  test-branch 120f7ab Adding tests

git checkout test-branch
Switched to branch 'test-branch'

See git checkout to learn more about it.

Last modified on November 30, 2021.

You might also like