Summary - Git internals
- Git course
- Expert
- Lesson 4/32
- 5 min
Combine internal parts to draw an object map.
Overview of Git Internals
Git's internal structure consists of several core components working together. The .git directory contains this data; objects stores file contents and historical objects; and refs provides access to these objects through branches and tags.
.git/
├── objects/
└── refs/
├── heads/
└── tags/Understanding these components makes it easier to see how Git manages files and commit history.
Practice Inspect a File in the Object Database
Store the contents of index.html in the Git object database and display the resulting object ID. Use the write option of the hash-object command.
Starter code
# Dosya içeriğini nesne veritabanına yazExpected output
8f3a2b1c4d5e6f708192a3b4c5d6e7f8091a2b3c
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Named references that provide access to a branch's commit ID belong to which structure?
- hooks
- refs Correct answer
- Blob
- index
Explanation: Refs stores named references such as branches and tags.
2 Complete the Git Internals Map
.git/
├── objects/
└── refs/
├── heads/
└── tags/____
.git/
├── objects/
└── refs/
├── heads/
└── tags/refs
Explanation: Objects contains Git objects, while refs contains branch and tag references.
3 Parts of Git Internals
| Term | Meaning |
|---|---|
.git |
Contains internal repository data |
objects |
Stores blob, tree, and commit objects |
refs/heads |
Points to local branches |
refs/tags |
Points to tags |