intermediate

Debugging and history

Inspect history and regressions with log, diff, blame, bisect, and reflog before rewriting or recovering work.

Git history is a debugging dataset. `log`, `diff`, `blame`, `bisect`, and `reflog` help reconstruct intent, isolate regressions, compare releases, and recover local work when refs moved unexpectedly.

Subtopics: git log, git diff, git blame, git bisect, reflog.

On interviews: pick the right tool — diff for what changed, log for when and why, blame for line context, bisect for unknown regressions, reflog for local recovery.

Common pitfalls: history tools without tests; huge commits that defeat bisect; blame used as personal attribution.

The trade-off is investigation speed versus confidence — always verify conclusions with behavior and tests.

Checklist:

  • Start with a concrete question.
  • Prefer deterministic reproduction for regressions.
  • Combine log, diff, and show before editing code.
  • Verify conclusions with tests.