Courseiva

200-901 Software Development and Design Practice Question

Which Git command is used to switch to an existing branch named 'feature-x' and update the working directory?

⚠ Common exam trap

Cisco often tests the distinction between `git checkout` for switching to an existing branch versus `git checkout -b` (or `git switch -c`) for creating and switching to a new branch, and candidates frequently confuse the `-c` flag as a switch-only option rather than a creation flag.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

git checkout feature-x

`git checkout feature-x` is the traditional Git command that switches the HEAD reference to the existing branch 'feature-x' and updates the working directory to match that branch's commit history. This command performs both the branch switch and the working tree update in one operation, which is the core requirement of the question.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    git merge feature-x

    Why it's wrong here

    git merge integrates feature-x's commits into the current branch; it never changes which branch HEAD points to or updates the working tree to feature-x. Merging is correct when you want to combine completed branch work into your current line of development.

  • ✗

    git branch feature-x

    Why it's wrong here

    git branch feature-x only creates a new branch pointer at the current commit; it neither switches HEAD nor updates the working directory. It is the right command when you want to create a branch without leaving your current one.

  • ✗

    git switch -c feature-x

    Why it's wrong here

    The -c flag makes git switch create a brand-new branch named feature-x rather than checking out the existing one, so it fails if that branch already exists. Plain git switch feature-x is correct for moving to an existing branch.

  • ✓

    git checkout feature-x

    Why this is correct

    git checkout with a branch name switches HEAD to that existing branch and updates the working directory to match its committed tree, satisfying the stem's requirement to both switch branches and refresh files. git branch alone only lists or creates branches without changing the working directory.

About these practice questions

Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.