Git Branches Flashcards

1
Q

Command to create a new branch and switch to that branch?

A

git checkout -b <branch_name></branch_name>

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

what is a branch in git?

A

A branch is basically a pointer to the last commit. barnaches are nothing more but a pointer to a certain commit

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

command to create a new branch

A

git branch <branch_name></branch_name>

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

Command to switch to another existing branch

A

git checkout <branch_name></branch_name>

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

Command to delete a branch

A

git branch -d <branch_name></branch_name>

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

Command to list all branches

A

git branch

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

What is a HEAD in git branches?

A

A HEAD is where you are right now in the git repository. HEAD points to the last commit in the branch you are currently on. When you switch branches, the HEAD moves with you.

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

where does git by default point to?

A

git always points to the last commit of the currently checked out branch

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

Lets say you are in sarah branch, and made some changes, and all of them are committed. Now we want to merge that with the master branch, how do we do it?

A

First checkout to master branch
git checkout master
Then use the command -
git merge sarah

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

Two types of merges git can perform?

A

fast forward merge
no fast forward merge

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

what is a fast forward merge?

A

A fast-forward merge can happen when the current branch has no extra commits compared to the branch that we’re merging. This type of merge doesn’t create a new commit, but rather merges to commits on the branch that we’re merging right into the current
branch.

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

What is no fast forward merge/?

A

Git will perform a no-fast-forward merge. With a no-fast-forward merge, Git creates a new merging commit on the active branch. The commits parent commit to both the active branch and the branch we want to merge.

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