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
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.
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.
git 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.
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.
Takeaways
- git blame <file> attributes every real line currently in a file to the commit and author that last changed it
- git show <hash> reveals a commit's complete real message, author, date, and diff
- A real, well-written commit message often already contains the "why" — blame plus show can answer it without asking anyone
- Writing the answer back into the file turns a one-time investigation into permanent, shared documentation