0
0
Gitdevops~5 mins

Creating branches with git branch - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What does the command git branch do?
It lists all the branches in your repository and shows which branch you are currently on.
Click to reveal answer
beginner
How do you create a new branch named feature using git?
Use the command git branch feature to create a new branch called feature.
Click to reveal answer
beginner
Does git branch new-branch switch you to the new branch?
No, it only creates the branch. You stay on the current branch until you use git checkout new-branch or git switch new-branch.
Click to reveal answer
intermediate
What command creates and switches to a new branch in one step?
Use git checkout -b branch-name or git switch -c branch-name to create and switch to a new branch at once.
Click to reveal answer
beginner
Why use branches in git?
Branches let you work on different features or fixes separately without changing the main code. It’s like having separate workspaces for different tasks.
Click to reveal answer
What does git branch without arguments do?
ALists all branches and shows the current branch
BCreates a new branch
CDeletes a branch
DSwitches to a branch
Which command creates a new branch called dev?
Agit branch dev
Bgit checkout dev
Cgit switch dev
Dgit merge dev
After running git branch feature, what is your current branch?
Afeature
Bmain (or current branch before command)
Cdetached HEAD
DNo branch
Which command both creates and switches to a new branch named test?
Agit merge test
Bgit branch test
Cgit branch -d test
Dgit checkout -b test
Why is branching useful in git?
ATo delete old code
BTo speed up the computer
CTo work on different tasks separately
DTo backup files
Explain how to create a new branch and switch to it in git.
Think about commands that create and switch branches.
You got /4 concepts.
    Why should you use branches when working with git?
    Imagine working on different projects at the same time.
    You got /4 concepts.