Git Basics Flashcards
How does git store data?
Key value store
Value = Data
Key = Hash of the Data (SHA1)
What is a blob?
git stores compressed data in a blob along with metadata
What is part of the blob?
identifier: blob
size of the content
0/ delimiter
content
How can you get the SHA1 of contents without metadata?
echo ‘Hello world!’ | git hash-object –stdin
How can you get the SHA1 of content + metadata?
echo ‘blob 14\0Hello, World!’ | openssl sha1
Where are blobs stored?
Inside the objects folder
What parts are missing inside the blob?
Filenames and directory structure
What kind of metadata is stored in trees?
type of pointer (blob or tree)
filename or directory name
mode (executable file, symbolic link, …)
What’s the main purpose of a tree?
Contains pointers (SHA1) to either blobs or other trees
What does a commit point to?
a tree
What kind of metadata does a commit contain?
author and commiter
date
message
parent commit (one ore more)
What’s the SHA1 of a commit?
hash of all the information of a commit
How can you get the type of a hash?
git cat-file -t 980a0
How can you ge tthe content of a hash?
git cat-file -p 980a0
Where can you find the branches in git?
.git/refs/heads
What are references?
Pointers to commits