Question
What command should you type to create and switch over to a new branch?
- A. git checkout -n newBranchName
- B. git checkout -b newBranchName Correct
- C. git checkout newBranchName
- D. git branch newBranchName
Explanation
git checkout -b newBranchName creates the branch and checks it out in a single step (git switch -c does the same in newer Git versions). git branch newBranchName only creates the branch and leaves you on the current one. git checkout newBranchName switches to a branch that already exists, and -n is not a branch-creation option of git checkout.