Interview Prep/Git & GitHub/Merge and Rebase Problems

After a merge, a colleague's change is silently missing and nobody saw a conflict.

AdvancedTroubleshootingMerge and Rebase Problems
Answer

Likely causes → A bad hand-resolution kept only one side; -X ours or -s ours was used; an earlier reverted merge masks commits (Git thinks they are already in); or the commit was dropped during a rebase or squash.

Diagnose →

git log --full-history --oneline -S'missing_function' -- path/to/file
git show --cc <merge-sha>
git merge-base --is-ancestor <lost-commit> HEAD && echo "ancestor, so content was lost in a resolution"
git log --merges --grep='Revert' --oneline

Fix → Re-apply the lost change with git cherry-pick <lost-commit> (or revert the earlier revert-of-merge). Add a regression test.

Prevent → Review merge commits with --cc, avoid blanket -X strategies, and require passing CI on the merged result.

All Git & GitHub questions Roadmap: Git & GitHub

More on Merge and Rebase Problems