Recall & Review
beginner
What git command creates a new branch and switches to it immediately?
The command
git switch -c <branch-name> creates a new branch and switches to it in one step.Click to reveal answer
beginner
What does the
-c option do in git switch -c?The
-c option stands for 'create'. It tells git to create a new branch before switching to it.Click to reveal answer
beginner
How would you create and switch to a branch named
feature1?Use the command
git switch -c feature1. This creates the branch feature1 and switches to it.Click to reveal answer
intermediate
What is the difference between
git checkout -b and git switch -c?git checkout -b also creates and switches to a new branch, but git switch -c is a newer, clearer command introduced to separate switching branches from other checkout tasks.Click to reveal answer
beginner
Can you switch to an existing branch using
git switch?Yes, simply use
git switch <branch-name> without -c to switch to an existing branch.Click to reveal answer
Which command creates and switches to a new branch named 'dev' in one step?
✗ Incorrect
git switch -c dev creates the new branch 'dev' and switches to it immediately.
What does the command
git switch -c feature do?✗ Incorrect
The -c option creates a new branch before switching to it.
Which command is the newer, clearer way to create and switch branches in git?
✗ Incorrect
git switch -c is the newer command designed for creating and switching branches.
How do you switch to an existing branch named 'main' using git switch?
✗ Incorrect
git switch main switches to the existing branch 'main'.
What happens if you run
git switch -c with a branch name that already exists?✗ Incorrect
Git will show an error because the branch name already exists and cannot be created again.
Explain how to create a new branch and switch to it in one step using git.
Think about the command that combines creation and switching.
You got /3 concepts.
Describe the difference between
git checkout -b and git switch -c.Focus on the purpose and clarity of the commands.
You got /3 concepts.