Branching Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is Git Branching

A

Diverge from the main line of development and continue to do work without messing with that mainline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to create Local Branch

A

git branch branch-name

eg: git branch Testing-branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to check on which branch currently working

A

by using a special pointer called Header - to points to the current checkout branch.
git log –oneline –decorate – graph –all

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to check what are the branches created

A

git branch -> display local branches
git branch -r -> remote branches
git branch -a -> display both remote and local
branches

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to checkout to the particular branch

A

git checkout branch-name

eg: git checkout Testing-branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to checkout to the particular branch in version 2.23

A

git switch branch-name

eg: git switch Testing-branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to create and checkout in one line

A
git checkout -b branch-name
git checkout -b Testing-branch-two
or
git switch -c  branch-name
git switch -c Testing-branch-two

Note: both -b and -c are used to create a new branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to check branches merged

A

git branch –merged

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to check the unmerged branch

A

git branch –no-merged

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to check the last commit on each branch

A

git branch -v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to delete the branch

A

git branch -d branch-name

git push remote –delete branch-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to delete the branch forcibly

A

git branch -D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to change the branch name -Local

A

git branch –move

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to change the branch name remotely

A

Step1: git branch –move
Step2: git push –set-upstream origin
Step3: git push origin –delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Is it a good idea to change the name of the branch master

A

Changing the name of a branch like master/main/mainline/default will break the
integrations, services, helper utilities and build/release scripts that your repository
uses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly