A feature worked yesterday. Itโs broken today. I donโt guess when this happens โ I compare the two commit states directly and let Git tell me exactly what changed. Commit comparison is the practice of diffing two points in a repositoryโs history to isolate which commit introduced a regression. Hereโs the workflow I actually use: pick a good and a bad commit, diff them precisely, and recover only what you need without dragging the rest along with it.
Step 1: Identify the Commit Range with git log
Start with the shape of your history:
git log --oneline--decorate--graph
From that graph, pick two points:
GOOD_COMMIT โ the last commit you know worked.
BAD_COMMIT โ the first commit where things broke.
Everything else in this workflow hangs off those two references.
The range GOOD_COMMIT..BAD_COMMIT covers every commit in between โ thatโs what git diff, git log -p, and the recovery commands in the next steps all operate on.
Step 2: Compare Commit States with git diff and git show
git diff is a Git command that compares two references โ commits, branches, or the working tree โ and prints the line-by-line changes between them. Once you have your range, git diff shows you exactly what changed:
git diff GOOD_COMMIT..BAD_COMMIT
Narrow it to one file when you already suspect where the regression lives:
git show is a Git command that displays a single commitโs metadata (author, date, message) together with its full patch. When you want the full picture on the bad commit in one go, git show gives you that:
git show BAD_COMMIT
Step 3: Inspect the History in the Range with git log -p
A diff tells you what changed overall, but sometimes you need it commit by commit. git log is a Git command that lists commits reachable from a given range; with -p, it also prints each commitโs patch:
The first command gives you a quick list of suspects. The second shows the actual patch for each one, so you can spot which commit introduced the regression rather than just knowing it happened somewhere in the range.
Step 4: Create a Safety Branch Before Recovery
๐ Subscribe to keep reading.
Step 5: Recover Good Changes with git cherry-pick or git revert
๐ Subscribe to keep reading.
Step 6: Resolve Merge Conflicts During Cherry-pick or Revert
๐ Subscribe to keep reading.
Mental Model: Commits as Before-and-After Photographs
๐ Subscribe to keep reading.
Checklist for Debugging a Regression by Comparing Commits
๐ Subscribe to keep reading.
Summary: Debugging Git Regressions by Comparing Commits
๐ Subscribe to keep reading.
References
๐ Subscribe to keep reading.
Subscribe to unlock the full article โค๏ธ
I keep most of the site completely open. A few unusually detailed tutorials need a free subscriber login so I can keep publishing this kind of work.
The form below signs you up for the newsletter. It does not log you into the app โ log in afterwards (same email) to unlock this article and download your subscriber gifts. New subscribers get an inbox mail: Set a password to unlock articles.
Full content temporarily unavailable โ refresh in a moment
Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.
Citation
Elena Daehnhardt. (2026) 'Debugging Git Commits: Finding Exactly What Broke', daehnhardt.com, 12 July 2026. Available at: https://daehnhardt.com/blog/2026/07/12/git-commit-differences/