Git Basics Flashcards

(42 cards)

1
Q

How does git store data?

A

Key value store
Value = Data
Key = Hash of the Data (SHA1)

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

What is a blob?

A

git stores compressed data in a blob along with metadata

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

What is part of the blob?

A

identifier: blob
size of the content
0/ delimiter
content

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

How can you get the SHA1 of contents without metadata?

A

echo ‘Hello world!’ | git hash-object –stdin

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

How can you get the SHA1 of content + metadata?

A

echo ‘blob 14\0Hello, World!’ | openssl sha1

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

Where are blobs stored?

A

Inside the objects folder

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

What parts are missing inside the blob?

A

Filenames and directory structure

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

What kind of metadata is stored in trees?

A

type of pointer (blob or tree)
filename or directory name
mode (executable file, symbolic link, …)

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

What’s the main purpose of a tree?

A

Contains pointers (SHA1) to either blobs or other trees

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

What does a commit point to?

A

a tree

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

What kind of metadata does a commit contain?

A

author and commiter
date
message
parent commit (one ore more)

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

What’s the SHA1 of a commit?

A

hash of all the information of a commit

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

How can you get the type of a hash?

A

git cat-file -t 980a0

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

How can you ge tthe content of a hash?

A

git cat-file -p 980a0

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

Where can you find the branches in git?

A

.git/refs/heads

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

What are references?

A

Pointers to commits

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

What is HEAD refering to?

A

Current branch & commit

18
Q

How can you check where a branch points to?

A

cat .git/refs/heads/master

19
Q

How can you check where a reference points to?

A

cat .git/HEAD

20
Q

What areas are there in git?

A

Working area, staging area and repository

21
Q

What files belong to the working area?

A

untracked files

22
Q

What is the staging area?

A

Containts the files that are going to be part of the next commit

23
Q

How can you check what’s inside the staging area?

A

git ls-files -s

24
Q

How can you remove a file from git?

25
How can you rename a file in the next commit?
git mv
26
How can you add in hunks?
git add -P
27
What is stashing good for?
save un-commited work that needs to be safe from destructive operations
28
Show all stashes?
git stash list
29
Stash changes
git stash
30
Show specific stash
git stash show stash@{0}
31
Apply last stash
git stash apply
32
Include untracked files in stashes
git stash --include-untracked
33
Naming stashes
git stash save "message"
34
Start branch from stash
git stash branch
35
Remove last stash and apply changes
git stash pop
36
Remove last stash
git stash drop
37
Remove all stashes
git stash clear
38
What are references?
Pointers to commits
39
3 types of references
HEAD Tags & annotated tags Branches
40
What is a branch?
Pointer to a particular commit
41
What is a detached HEAD?
HEAD points to a commit
42
What is HEAD?
Pointer that points to the current branches name/commit