Switching branches in one of the most common operations when using Git.
Pass a branch name to
git checkout to switch to a different branch.
# Checkout the master branch git checkout master # Checkout the dev branch git checkout dev
-b flag to
git checkout to create a new branch and also switch to it.
# Create and checkout my-new-branch git checkout -b my-new-branch