Git Internals — How Git Really Works — Concept Check
Questions on Git Internals — How Git Really Works. Git stores everything as four object types in a content-addressable store: blobs (file content), trees (directories), commits (snapshots), and tags. Every object is identified by its SHA-1 hash.
Questions in this quiz
8 questions on Git Internals — How Git Really Works — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a file with identical content in two branches. What happens when you run 'git gc'?
- AThe file content will be converted into a tree object.
- BBoth branches will have separate blob objects for the file.
- CThe file content will be lost from one of the branches.
- DThe file content will be deduplicated into a single blob object.
2.A developer notices a 'detached HEAD' state. What does this mean for their Git repository?
- AAll branches have been deleted.
- BHEAD is pointing to a non-existent commit.
- CThe repository is corrupted and needs repair.
- DHEAD is pointing to a specific commit, not a branch.
3.What object type does Git use to store directory listings?
- ATag
- BBlob
- CTree
- DCommit
4.A developer runs 'git cat-file -t' on a hash and sees 'commit'. What does this object contain?
- ASnapshot of the project state with parent commit info.
- BDirectory listing with names and permissions.
- CFile content without metadata.
- DA named pointer to another object.
5.Why is Git's history considered tamper-evident?
- ASHA-1 hashes are encrypted and unbreakable.
- BGit tracks every change with timestamps.
- CIdentical content in different commits has different hashes.
- DChanging any byte in an object changes its hash.
6.What happens when you create a new branch in Git?
- AAll files are duplicated for the new branch.
- BA new directory is created in the repository.
- CThe HEAD pointer is permanently moved to the new branch.
- DA 41-byte file is created pointing to a commit hash.
7.How does Git ensure that identical files across branches are stored efficiently?
- ABy storing each file in a separate branch-specific blob.
- BBy compressing all files into a single archive.
- CBy using SHA-1 to hash and deduplicate identical content.
- DBy converting files into tree objects.
8.What is the role of a tag in Git?
- AStores raw file content without metadata.
- BPoints to a specific commit or other object.
- CHolds a snapshot of the project state.
- DLists directory contents with permissions.