Module 5: Inspecting and Repairing History

Reading Logs and File History

Reading logs and file history

Git history is useful only if you know how to read it. Start with concise logs, then add detail when you need it.

git log --oneline
git log --oneline --decorate --graph --all
git show HEAD
Representative output
commit d4e5f6a7b8c9
Author: Alex Engineer <[email protected]>

    Add focused change

 app.conf | 2 +-

git show displays one commit with its metadata and diff. Replace HEAD with any commit hash.

File-specific history

git log -- README.md
git log -p -- README.md
git blame README.md
Representative output
a1b2c3d1 (Alex Engineer 2026-08-18 10:30:00 +0530 1) version=1.0.0

git blame shows the last commit that changed each line. Use it to find context, not to assign fault. Follow up with git show to understand the complete commit.

Searching history

git log --grep="payment"
git log -S"function_name" -- path/to/file
Representative output
* d4e5f6a (HEAD -> main) Add focused change
* a1b2c3d Create project baseline

These commands help answer when a behavior appeared, where a line came from, or why an implementation changed.