Interview Prep/Git & GitHub/Branching and Merging Workflows

You reverted a merged feature, fixed it, and merged the branch again, but the original changes are missing. What happened?

AdvancedScenarioBranching and Merging Workflows
Answer

Situation read → Reverting a merge creates a commit that undoes the changes but leaves the original commits in history. Git thinks those commits are already merged, so a second merge brings nothing from them.

What I'd do →

  1. Revert the revert on main: git revert <revert-commit-sha>. This brings the original changes back.
  2. Merge the fixed branch; only the new fix commits are added.
  3. Alternative: rebase or cherry-pick the feature commits to new SHAs on a fresh branch and open a new PR.

Why → Merge logic works on commit ancestry, not content. The reverted commits remain ancestors.

Interview tip → This is Linus's well-known "reverting a merge" caveat. Naming it shows depth.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows