History, Inspection & Debugging
A repository is a searchable record of decisions. This chapter teaches you how to interrogate that record and recover when the shape of history surprises you.
Diff & Show
Reading changes at file, hunk, commit, branch, and staged-versus-unstaged levels.
Log Queries & Revision Syntax
Filtering history by path, author, time, message, ancestry, ranges, and commit selectors.
Blame & Archaeology
Tracing why a line changed while accounting for renames, formatting churn, and context.
Bisect
Binary-searching history to find the commit that introduced a regression.
Stash & Clean
Temporarily shelving work, restoring it safely, and removing generated or untracked files.
Reflog Recovery
Using reflog to recover lost commits, undone branches, hard resets, and other near-misses.
Reset, Restore & Revert
Choosing the right undo tool for files, commits, published history, and local experiments.
History Rewriting
Surgically rewriting committed history with git filter-repo — removing leaked secrets, extracting subtrees, restructuring repos.