You need to revert a merge commit on `main`. `git revert` says "commit is a merge but no -m option was given".
IntermediateScenarioUndoing Mistakes
Answer
Situation read → A merge has two parents, so Git cannot know which side's changes to undo.
What I'd do →
- Pick the mainline parent, which is normally parent 1 (the branch merged into):
git revert -m 1 <merge-sha>. - Push the revert commit.
- Remember the re-merge caveat: to reapply the feature later, revert this revert first.
Why → -m 1 means "keep the first-parent line, undo what the second parent brought in".
Interview tip → Check parents with git show --no-patch --format=%P <sha>.
More on Undoing Mistakes
You committed on `main` when you meant to be on a feature branch. Nothing is pushed. Fix it.BeginnerYou made a typo in your last commit message and have not pushed.BeginnerA bad commit is already on shared `main`. Others have pulled it. How do you undo it?IntermediateYou ran `git reset --hard` and lost uncommitted-then-committed work. Can you get it back?IntermediateYou deleted a local branch with unmerged work by mistake.BeginnerAfter `git stash pop` you got conflicts. Is your stash lost?Intermediate