Git Blame: Who Wrote This and Why
A shared file, three real teammates, one genuine "magic number." Who changed it, and why?
kitchen-tips.md is a real, shared file — genuinely edited by three different real teammates over several commits. One line reads "preheat for at least 12 minutes before baking," and the number is oddly specific: not 10, not 15. Nobody currently working on the recipes remembers why.\n\ngit blame answers "who touched this line last, and in which real commit" for every single line in a file, all at once. Once you have the real commit hash, git show reveals its complete real message — and a real, professional commit message often already contains the "why," if whoever wrote it took the time to explain their reasoning.
Every Real Line, Attributed
git blame kitchen-tips.md
Each real line shows its own commit hash, real author, and real date — the moment that exact line last changed, whether it was created then or edited later.
From a Hash to the Full Real Story
git show cc74e46
A commit hash from blame is a real pointer to that commit's complete message, real author, real date, and real diff — often enough, on its own, to answer "why" without asking anyone.
Closing the Loop
sed -i 's/12 minutes before baking\./12 minutes before baking (see PR #142)./' kitchen-tips.md
git commit -am "Cite PR #142 directly in the preheat tip"
Once the real reasoning is found, writing it back into the file means the next person who wonders "why 12?" never has to repeat this dig.
git blame <file>
Shows the real commit, author, and date responsible for every line currently in a file. Confirmed directly in this lab: three genuinely different teammates each owned different real lines of the same shared file.
git show <hash>
Displays one real commit's complete metadata and diff. Confirmed directly in this lab: the commit blame pointed to had a real, named pull-request reference in its own message — the actual "why," already written down.
🔎 Blame the Shared File
See exactly which real teammate and commit owns each line.
cd ~/team-recipes && git blame kitchen-tips.mdstudent@lab:~$ cd ~/team-recipes && git blame kitchen-tips.md 27b1b01c (Ada Lovelace 2026-01-02 19:30:00 +0000 1) Kitchen Tips 27b1b01c (Ada Lovelace 2026-01-02 19:30:00 +0000 2) 27b1b01c (Ada Lovelace 2026-01-02 19:30:00 +0000 3) Preheat the oven before starting any bake recipe. 0fb0795a (Frank Chen 2026-01-02 19:40:00 +0000 4) cc74e46f (Grace Hopper 2026-01-02 19:50:00 +0000 5) Always preheat for at least 12 minutes before baking. 34fe3252 (Ada Lovelace 2026-01-02 20:00:00 +0000 6) 34fe3252 (Ada Lovelace 2026-01-02 20:00:00 +0000 7) Let meat rest 5 minutes after cooking before slicing.
📖 Read the Real Full Story
Confirm the commit history, then read that exact commit's complete message.
cd ~/team-recipes && git log --oneline -- kitchen-tips.mdcd ~/team-recipes && git show cc74e46student@lab:~$ cd ~/team-recipes && git log --oneline -- kitchen-tips.md 34fe325 (HEAD -> master) Add resting-time reminder for cooked meat cc74e46 Merge pull request #142: adjust preheat timing based on oven latency testing 0fb0795 Add preheat duration guidance 27b1b01 Add kitchen-tips.md with a basic preheating reminder student@lab:~$ cd ~/team-recipes && git show cc74e46 commit cc74e46f621a4a823badcd9382176e9a96112bac Author: Grace Hopper <grace@example.com> Date: Fri Jan 2 19:50:00 2026 +0000 Merge pull request #142: adjust preheat timing based on oven latency testing diff --git a/kitchen-tips.md b/kitchen-tips.md index d37acd9..8defc6b 100644 --- a/kitchen-tips.md +++ b/kitchen-tips.md @@ -2,4 +2,4 @@ Kitchen Tips Preheat the oven before starting any bake recipe. -Always preheat for at least 10 minutes before baking. +Always preheat for at least 12 minutes before baking.
📝 Cite It for the Next Reader
Write the real answer directly into the file, so nobody has to dig again.
cd ~/team-recipes && sed -i 's/at least 12 minutes before baking\./at least 12 minutes before baking (see PR #142 for the oven latency testing behind this number)./' kitchen-tips.mdcd ~/team-recipes && git add kitchen-tips.mdcd ~/team-recipes && git commit -m 'Cite PR #142 directly in the preheat tip'cd ~/team-recipes && cat kitchen-tips.mdstudent@lab:~$ cd ~/team-recipes && sed -i 's/at least 12 minutes before baking\./at least 12 minutes before baking (see PR #142 for the oven latency testing behind this number)./' kitchen-tips.md student@lab:~$ cd ~/team-recipes && git add kitchen-tips.md student@lab:~$ cd ~/team-recipes && git commit -m 'Cite PR #142 directly in the preheat tip' [master 61de3e6] Cite PR #142 directly in the preheat tip 1 file changed, 1 insertion(+), 1 deletion(-) student@lab:~$ cd ~/team-recipes && cat kitchen-tips.md Kitchen Tips Preheat the oven before starting any bake recipe. Always preheat for at least 12 minutes before baking (see PR #142 for the oven latency testing behind this number). Let meat rest 5 minutes after cooking before slicing.
Lab 3.3.3 complete. A real magic number, traced to its exact source and documented:\n\n\n git blame kitchen-tips.md : ✅ 3 real teammates, 3 commits\n git show cc74e46 : ✅ real PR #142 reasoning found\n Cited in the file : ✅ committed for the next reader\n
Enable JavaScript to run the live terminal and track your progress.