Interview Prep/Git & GitHub/Undoing Mistakes

A bug fix commit on `main` must be reverted from `release/3.0`, but later commits touched the same lines.

AdvancedScenarioUndoing Mistakes
Answer

Situation read → A plain revert will conflict because the surrounding code changed.

What I'd do →

  1. git switch release/3.0 && git revert <sha>.
  2. Resolve conflicts using zdiff3 markers, comparing against the original commit's diff: git show <sha>.
  3. If dependent commits are required, decide: revert those too, or fix forward with a targeted patch.
  4. Run the release test suite, then open a PR to the release branch.

Why → Revert is a reverse cherry-pick, so it is only as clean as the surrounding context.

Interview tip → Say you would ask whether the release needs the revert at all, or a smaller targeted fix.

All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing Mistakes