Git Basics Flashcards

You may prefer our related Brainscape-certified flashcards:
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?

A

git rm

25
Q

How can you rename a file in the next commit?

A

git mv

26
Q

How can you add in hunks?

A

git add -P

27
Q

What is stashing good for?

A

save un-commited work that needs to be safe from destructive operations

28
Q

Show all stashes?

A

git stash list

29
Q

Stash changes

A

git stash

30
Q

Show specific stash

A

git stash show stash@{0}

31
Q

Apply last stash

A

git stash apply

32
Q

Include untracked files in stashes

A

git stash –include-untracked

33
Q

Naming stashes

A

git stash save “message”

34
Q

Start branch from stash

A

git stash branch

35
Q

Remove last stash and apply changes

A

git stash pop

36
Q

Remove last stash

A

git stash drop

37
Q

Remove all stashes

A

git stash clear

38
Q

What are references?

A

Pointers to commits

39
Q

3 types of references

A

HEAD
Tags & annotated tags
Branches

40
Q

What is a branch?

A

Pointer to a particular commit

41
Q

What is a detached HEAD?

A

HEAD points to a commit

42
Q

What is HEAD?

A

Pointer that points to the current branches name/commit