Interview Prep/Git & GitHub/Undoing Mistakes

A release introduced a regression from five consecutive commits. How do you revert them as one change?

IntermediateScenarioUndoing Mistakes
Answer

Situation read → You want one clean revert rather than five.

What I'd do →

  1. Find the range: git log --oneline -8.
  2. git revert --no-commit OLDEST^..NEWEST applies all inverses to the index, newest first.
  3. Fix conflicts if later commits overlap, then git commit -m "Revert checkout rewrite (INC-4821)".
  4. Push and open a PR for review.

Why → --no-commit lets you bundle the reverts and describe them with the incident reference.

Interview tip → Alternative: revert the single squash or merge commit that brought the work in.

All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing Mistakes