Running Project: my-notes
Starting state: one commit on main — notes.txt with "Day 1: Learning Git with RR Skillverse." (Part 2 complete).
Ending state: same repo, no new commits. You're reading existing data, not adding to it.
All hashes you'll see are unique to your repository. Every output in this post uses placeholder values like a3f7b21 — substitute your real hashes at each step.
Step 1 — Get Your Commit Hash
Why: Every Git object is addressed by its hash. You need the hash of your Part 2 commit to start tracing the chain.
Command:
git log --oneline
Expected output:
a3f7b21 (HEAD -> main) Add initial notes file
Your hash will be different — every commit hash is unique. Copy the 7-character prefix from your output (or the full 40 characters from git log). Git accepts any unambiguous prefix for all cat-file commands below.
Self-check: One line in the log. Hash, branch label, and your commit message from Part 2.
Step 2 — Confirm the Object Type
Why: Before reading an object, verify Git categorises it correctly. This also demonstrates that git cat-file works on any hash — commit, tree, or blob.
Command:
git cat-file -t a3f7b21
Replace a3f7b21 with your actual hash.
Expected output:
commit
Self-check: The single word commit on its own line. No errors.
Step 3 — Read the Commit Object
Why: The commit object contains the tree hash you need for the next step. Reading it directly shows you exactly what Git stored — the same data that produced your commit hash.
Command:
git cat-file -p a3f7b21
Expected output:
tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 author Your Full Name <your@email.com> 1723027425 +0530 committer Your Full Name <your@email.com> 1723027425 +0530 Add initial notes file
Read the output:
tree 4b825d...— the hash of the tree object this commit points to. Copy this hash.- No
parentline — this is a root commit. The first commit in any repository has no parent by definition. Subsequent commits will show oneparent <hash>line; merge commits show two. authorandcommitter— your identity fromgit config, plus a Unix timestamp (seconds since 1970-01-01 UTC) and timezone offset.- Blank line, then the commit message exactly as you typed it.
Self-check: Your name and email match what you set in Part 1 with git config. The tree hash is 40 characters.
Step 4 — Read the Tree Object
Why: The tree is where filenames live — not in the blob. This step shows the link between the filename notes.txt and its blob hash.
Command:
git ls-tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
Replace with your actual tree hash from Step 3.
Expected output:
100644 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f notes.txt
Note: the separator between the hash and the filename is a tab character, not spaces.
Read the output:
100644— permission mode. 100644 = regular non-executable file. 100755 = executable. 040000 = directory (which would point to another tree).blob— this entry points to a blob object.f2ba8f...— the hash of the blob containingnotes.txt's content. Copy this hash.notes.txt— the filename. One row per file in this directory.
Self-check: Exactly one row (the repository has only one file). Blob hash is 40 characters.
Step 5 — Confirm the Blob Type
Why: Complete the pattern. You confirmed a commit is a commit, a tree is a tree — now confirm a blob is a blob. This is also useful for verifying any unknown hash before reading it.
Command:
git cat-file -t f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f
Expected output:
blob
Self-check: The single word blob.
Step 6 — Read the Blob Content
Why: This is the payoff. The blob stores exactly what you wrote into notes.txt — raw bytes, nothing added. No filename. No path. No timestamp. Just the content.
Command:
git cat-file -p f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f
Expected output:
Day 1: Learning Git with RR Skillverse.
That's the exact text you saved in Part 2 — the complete content of notes.txt as Git stored it.
Note the separation of concerns: the blob doesn't know it's called notes.txt. That association is stored in the tree (Step 4). The blob only knows its content. This is why Git can deduplicate identical files across commits — both would point to the same blob hash.
Self-check: The output matches the text you saved in Part 2, character for character.
Step 7 — View the Commit Diff
Why: git show on a commit displays the metadata plus the diff — what changed compared to the parent. For the root commit, there is no parent, so the diff shows against an empty repository: every line is an addition.
Command:
git show a3f7b21
Expected output:
commit a3f7b21c9e4d5f8b1a2c3d4e5f6789012345678
Author: Your Full Name <your@email.com>
Date: Thu Aug 7 14:23:45 2026 +0530
Add initial notes file
diff --git a/notes.txt b/notes.txt
new file mode 100644
index 0000000..f2ba8f8
--- /dev/null
+++ b/notes.txt
@@ -0,0 +1 @@
+Day 1: Learning Git with RR Skillverse.
Read the diff:
--- /dev/null— the "before" state was nothing; the file didn't exist+++ b/notes.txt— the "after" state isnotes.txt@@ -0,0 +1 @@— hunk header: 0 lines removed, 1 line added starting at line 1+Day 1: ...— the+prefix marks an added lineindex 0000000..f2ba8f8— the blob hashf2ba8f8matches the first 7 characters of the blob hash from Step 4
Press q to exit the pager.
Self-check: One added line in the diff. The short blob hash in the index line matches the first 7 characters of your blob hash from Step 4.
The Complete Chain You Traced
git log --oneline
→ a3f7b21 (your commit)
git cat-file -p a3f7b21
→ tree: 4b825dc (the directory listing)
git ls-tree 4b825dc
→ blob: f2ba8f8 → notes.txt
git cat-file -p f2ba8f8
→ "Day 1: Learning Git with RR Skillverse."
Every piece of data in your repository follows this chain. Add ten more files, make fifty more commits — the structure stays identical: more blobs, more trees, more commits, all linked by hash. The three object types and their relationships never change.