nerdexam
Microsoft

GH-900 · Question #97

What command should you type to create and switch over to a new branch?

The correct answer is B. git checkout -b newBranchName. git checkout -b <new-branch> Create a new branch named <new-branch>, start it at <start-point>, and check the resulting [Not C] git checkout [<branch>] To prepare for working on <branch>, switch to it by updating the index and the files in the working tree, and by pointing HEAD…

Introduction to Git and GitHub

Question

What command should you type to create and switch over to a new branch?

Options

  • Agit checkout -n newBranchName
  • Bgit checkout -b newBranchName
  • Cgit checkout newBranchName
  • Dgit branch newBranchName

How the community answered

(53 responses)
  • A
    2% (1)
  • B
    91% (48)
  • C
    6% (3)
  • D
    2% (1)

Explanation

git checkout -b <new-branch> Create a new branch named <new-branch>, start it at <start-point>, and check the resulting [Not C] git checkout [<branch>] To prepare for working on <branch>, switch to it by updating the index and the files in the working tree, and by pointing HEAD at the branch. Local modifications to the files in the working tree are kept, so that they can be committed to the <branch>. https://git-scm.com/docs/git-checkout

Topics

#Git branching#Git commands#Creating branches#Switching branches

Community Discussion

No community discussion yet for this question.

Full GH-900 Practice