Git · Junior · Question 19 of 75

How do you create a branch and switch to it in one command?

Explanation

git switch -c (or the older git checkout -b) creates the branch at the current commit and switches to it. git branch feature alone only creates it.

Further reading

Problem with a question

Git · Junior · question 19

Test yourself

Take the Git · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz