nerdexam
CompTIACompTIA

XK0-005 · Question #699

XK0-005 Question #699: Real Exam Question with Answer & Explanation

The correct answer is D: git checkout -b staging. The git checkout -b staging command creates a new branch called staging and switches to it. This is useful when you want to create a new branch locally and begin working on it. The -b flag is used to create the branch if it doesn't exist.

Scripting, Containers, and Automation

Question

A DevOps engineer is working on a local copy of a Git repository. The engineer would like to switch from the main branch to the staging branch but notices the staging branch does not exist. Which of the following Git commands should the engineer use to perform this task?

Options

  • Agit branch -m staging
  • Bgit commit -m staging
  • Cgit status -b staging
  • Dgit checkout -b staging

Explanation

The git checkout -b staging command creates a new branch called staging and switches to it. This is useful when you want to create a new branch locally and begin working on it. The -b flag is used to create the branch if it doesn't exist.

Topics

#Git#Branching#Version Control#CLI Commands

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions