In version control using Git, which command creates a new isolated branch and switches your working directory to it simultaneously?

Answer and explanation

Correct answer: D. `git checkout -b <branch-name>`

  1. Step 1: The `git branch` command creates branches and `git checkout` switches between them.
  2. Step 2: Combining them with the `-b` flag (`git checkout -b <branch-name>` or `git switch -c <branch-name>`) creates the branch and immediately checks it out in a single command.
Answer
`git checkout -b <branch-name>`.
Why not the others: '`git commit -m`' records staged changes to repository history; '`git pull origin`' fetches and integrates remote changes; '`git merge`' joins two branches together.

Practise more Python Programming, Data Structures, Algorithms, Networks and Cybersecurity.

Free questions with an explanation for every one, and full timed Saudi Secondary School Certificate mock tests.