Git Flashcards

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

What is delta storage model of source code control?

A

First commit stores all the files, and the later commits stores the diffs from the original version and subsequent versions

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

What is DAG storage model of source code control?

A

It stores the snapshot of each file with each commit

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

What is the advantage of delta storage?

A

It is space efficient

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

How does the source code control taxonomy look like?

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

How to override the .git directory?

A

By using the GIT_DIR environment variable

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

What are the basic contents of git directory?

A

config file, hooks, index, object database, references

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

How is new content stored in the object database

A

type + ‘ ‘ + content.size + ‘\0’ + content

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

Which hash algorithm is used by git?

A

SHA1

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

How is content stored on the disk?

A

It is stored in a compressed format with the file name being the first few letters of the hash

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

What does git gc achieve?

A

It finds all the objects that point to the same file with minor differences, packs the changes in a .pack file and also creates a .idx file that points to different places in the .pack file. It also deletes the compressed objects after this activity

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

What is “loose format” vs “packed format”?

A

Objects stored in compressed form in directories are loose format, while objects stored in .pack file is packed format

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

What are 4 types of git objects?

A

blob, tree, commit, tag

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

What is a blob?

A

Every file is converted to a blob in the .git directory

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

How is a file converted to blob?

A

Take the file, add the header, calculate the checksum, compress and store the file

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

What is a tree object?

A

Every directory is a tree object

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

How is a tree object made?

A

A directory listing is made with each entry containing the mode of the file, type of the entry, checksum and the file name. Then it is compressed and stored as a tree object

17
Q

What does a commit object consist of?

A

A commit message, the author and email, a parent commit which is the commit before this commit and a tree pointer which is basically directory listing at the time of this commit message

18
Q

What is a tag object?

A

A pointer to the commit object, along with the tag name, author and a tag message

19
Q

What is a reference?

A

Its a movable pointers to commits

20
Q

Where are refs stored?

A

in .git/refs/* as simple files

21
Q

What does HEAD point to? What does tag, branch or remote point to?

A

a branch. Rest all point to a commit

22
Q

What happens when a file is changed and committed?

A

The blob for the corresponding file changes, and the tree that points to the blob changes and this change propagates up the hierachy until a new commit object is made that points to the new tree object, then the branch points to the new commit object and so does the HEAD

23
Q

What happens when we do a git checkout -b

A

HEAD points to a new branch which points to the current commit. The master pointer is not changed

24
Q

How does the history look like between git merge and git rebase

A

git rebase history looks like linear (one started where other left off) where as git merge history looks like parallel (both worked at the same time)

25
Q

What does master@{yesterday} mean?

A

where master is at, yesterday

26
Q

what does master@{5} mean?

A

5th prior value of master

27
Q

What does master^2 mean?

A

2nd parent of master (in case of multi-way merge)

28
Q

What does master~2 mean?

A

2nd grandparent of master

29
Q

What does master:/path/to/file give

A

It give the blob spec of that file in master

30
Q

What does v1.0:/path/to/file give?

A

Blob of the file in the tag v1.0

31
Q

What does … give? and .. give?

A

The former gives everything between two commits and the latter gives everything since that commit

32
Q

What does index file in .git track?

A

A simple file that tracks what is staged, what is modified and what is present in the git directory

33
Q

What are different git protocols to clone?

A

ssh, http[s], file:///, git://, rsync://

34
Q

How to make git log show the commits in different ways?

A

git log –pretty=oneline

git log –pretty=format

35
Q

What does fetch + merge otherwise called as?

A

pull

36
Q
A