CS FundamentalsVery hardProduct-company placement · Git interview

A faulty merge M of feature into main was undone with git revert -m 1 M. The feature team later fixes the bug with a new commit on feature and merges feature into main again. What goes wrong, and what is the fix?

  1. A. Only the new fix commit comes in, because Git considers the feature's earlier commits already merged; revert the revert first, then merge
  2. B. Nothing goes wrong; the whole feature returns automatically
  3. C. Git refuses the second merge
  4. D. The second merge duplicates every feature commit

Correct answer: A. Only the new fix commit comes in, because Git considers the feature's earlier commits already merged; revert the revert first, then merge

Reverting a merge undoes its changes but not its history: the feature's commits remain ancestors of main. Re-merging brings only newer commits, so the original feature code stays reverted until the revert itself is reverted.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic