Udacity lesson 5 Flashcards

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

point out certain commits in order to let them stand out

A

git tag -a some_tag -m “Message to be added”

-a stands for annotated. You can also add a message through -m

last commit: just like above, the commits somewhere before:

git tag -a tags_name commit_s_number_in_7_digits -m “Message”

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

see all tags that are in the repository

A

git tag

but to see where they are - git log

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

what does git tag -a blah do?

A

it it adds a tag to the last commit. The tag is visible if you want to see all the commits, also with –oneline

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

delete a tag

A

git tag -d tag_name

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

how do branches work?

A

you move the pointer called head to the specific commit in a specific branch. That branch then appears in your code editor, and there the next commit will be added.

So if you point at the last commit of one of the existing branches, it will add to that branch. If you point your “head” somewhere in the middle of the branch, it will create a new branch from there.

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

create a new branch

A

situate the pointer at the right commit somehow

git branch name_of_branch

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

switch between branches

A

git checkout name_of_the_branch_to_switch_to

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

start a new branch at a certain commit

A

git branch name_of_the_branch commits_number

git checkout name_of_the_branch

or your could do the first one also with the name of the branch that’s on the same commit now (it’s HEAD is there) as the one you want

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

list out the branches in a repository

A

git branch

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

what happens when you run git checkout branch_name?

A

removes all files and directories from the Working Directory that Git is tracking (files that Git tracks are stored in the repository, so nothing is lost)

goes into the repository and pulsl out all of the files and directories of the commit that the branch points to

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

how to know in which branch I am?

A

git branch

the one with * is the current one

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

delete a branch

A

switch to another branch

git branch -d branch_name

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

why isn’t it deleting my branch? what to do?

A

because it has unique commits

merge it with some other branch or

git branch -D branch_name

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

Switch and create branch in one command

A

git checkout -b new_branch_name

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

see commits of all branches in a single output

A

git log –oneline –graph –all

–graph creates the visualization of the tree

–all ensures all branches are represented

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

merge branches

A

checkout the branch that will encompass another branch, then

git merge name-of-branch-to-merge-in

so not the one at which you are, but the other one, that should be incorporated

17
Q

undo the merge

A

git reset –hard HEAD^

18
Q

what will git do when you use the git merge command?

A

look at the branches that it’s going to merge

look back along the branch’s history to find a single commit that both branches have in their commit history

combine the lines of code that were changed on the separate branches together

makes a commit to record the merge

19
Q

fast-forward merge

A

when the branch that’s merged in contains next steps for the checked out branch

will move the currently checked out branch forward until it points to the same commit that the other branch is pointing to. So it moves the HEAD (the pointer), it doesn’t create a new commit

20
Q

When a merge is performed and fails, that is called

A

a merge conflict

21
Q

what will I see if a merge conflict occurs?

A

Git will try to combine as much as it can, but then it will leave special markers (e.g. > > > and < < < ) that tell you where you need to manually fix.

22
Q

when does a merge conflict happen?

A

when the exact same line(s) are changed in separate branches

23
Q

what do the indicators of the merge conflict mean?

A
24
Q

resolve merge conflict

A

remove all conflict indicators

write the piece of the code that causes conflict the way you want it to be, delete all the alternative versions, save, stage and commit the new version

you could also just commit it with all the indicators, but that’s a bit useless, and how will this code work anyways?

! Be careful that a file might have merge conflicts in multiple parts of the file, so make sure you check the entire file for merge conflict indicators - a quick search for < < < (without spaces) should help you locate all of them.