0
0
Gitdevops~5 mins

Creating and switching in one step in Git - Quick Revision & Summary

Choose your learning style9 modes available
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?
Agit switch dev
Bgit branch dev
Cgit switch -c dev
Dgit checkout dev
What does the command git switch -c feature do?
ACreates a new branch named 'feature' and switches to it
BDeletes the branch named 'feature'
CSwitches to an existing branch named 'feature'
DLists all branches
Which command is the newer, clearer way to create and switch branches in git?
Agit checkout -b
Bgit switch -c
Cgit branch -c
Dgit create -s
How do you switch to an existing branch named 'main' using git switch?
Agit switch main
Bgit switch -c main
Cgit checkout -b main
Dgit branch main
What happens if you run git switch -c with a branch name that already exists?
AGit deletes the existing branch and creates a new one
BGit creates a new branch with the same name
CGit switches to the existing branch
DGit shows an error that the branch already exists
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.