Git Flashcards
(36 cards)
What is delta storage model of source code control?
First commit stores all the files, and the later commits stores the diffs from the original version and subsequent versions
What is DAG storage model of source code control?
It stores the snapshot of each file with each commit
What is the advantage of delta storage?
It is space efficient
How does the source code control taxonomy look like?

How to override the .git directory?
By using the GIT_DIR environment variable
What are the basic contents of git directory?
config file, hooks, index, object database, references
How is new content stored in the object database
type + ‘ ‘ + content.size + ‘\0’ + content
Which hash algorithm is used by git?
SHA1
How is content stored on the disk?
It is stored in a compressed format with the file name being the first few letters of the hash
What does git gc achieve?
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
What is “loose format” vs “packed format”?
Objects stored in compressed form in directories are loose format, while objects stored in .pack file is packed format
What are 4 types of git objects?
blob, tree, commit, tag
What is a blob?
Every file is converted to a blob in the .git directory
How is a file converted to blob?
Take the file, add the header, calculate the checksum, compress and store the file
What is a tree object?
Every directory is a tree object
How is a tree object made?
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
What does a commit object consist of?
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
What is a tag object?
A pointer to the commit object, along with the tag name, author and a tag message
What is a reference?
Its a movable pointers to commits
Where are refs stored?
in .git/refs/* as simple files
What does HEAD point to? What does tag, branch or remote point to?
a branch. Rest all point to a commit
What happens when a file is changed and committed?
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
What happens when we do a git checkout -b
HEAD points to a new branch which points to the current commit. The master pointer is not changed
How does the history look like between git merge and git rebase
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)