What is the Git command to create and switch to a new branch named 'feature' in one step?

Prepare for the TJR Bootcamp Test with flashcards and detailed questions. Get hints and explanations for each query. Ace your exam!

Multiple Choice

What is the Git command to create and switch to a new branch named 'feature' in one step?

Creating a new branch and switching to it in one step is done by a command that both makes the branch and updates your working copy to that branch. The one that does this in a single action uses the -b flag to create the new branch named feature and immediately switch to it. Running it puts you right on the new feature branch, ready to start committing there.

In newer Git versions you could also achieve the same in one step with a different command that creates and switches, but among the given options, this is the one that both creates and checks out the new branch. The other commands don’t fit: switching to a branch requires it to already exist; creating a branch without switching leaves you on the current branch; and merging brings changes from another branch into your current one rather than creating or switching to a new branch.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy