🔀 The File Two Branches Both Agreed to Lose
Git’s three-way merge treats a file as cleanly resolved, with no conflict markers and no manual intervention needed, whenever both sides of the merge agree on the outcome for that file – and two branches that each independently deleted the same file, for entirely different and unrelated reasons, count as agreeing as far as the merge algorithm is concerned. One branch might have deleted a configuration file because it was replaced by a new settings system, while an unrelated branch deleted the same file because it moved into a different folder under a new name – the merge sees two deletions of the same path and completes without a single conflict, even though the second branch actually still needed that file to exist, just somewhere else.
🔎 The Problem
$ git log --oneline --graph --all * a1b2c3d (HEAD -> main) Merge branch 'rename-config' |\ | * d4e5f6a (rename-config) Move legacy.config to config/app.config * | 9f8e7d6 (remove-dead-code) Delete legacy.config (dead feature) |/ * 1234567 Base commit with legacy.config present $ git show a1b2c3d --stat # No conflict was ever reported during this merge - 'legacy.config' # simply disappears from the tree, because both branches agree it # should no longer exist at that path. The rename-config branch's # actual intent - that the FILE still exists, under config/app.config # - is invisible to a merge algorithm that only ever compares paths, # never file content moved to a new location. $ git show a1b2c3d -- config/app.config # fatal: path 'config/app.config' does not exist in 'a1b2c3d' either - # the rename branch's new file was never actually merged in, because # it lived on a commit this merge's history graph never touched.
✅ Fix: Treat a Clean Merge as a Starting Point, Not Proof of Correctness
- Diff the merge commit against each of its two parents individually right after merging, specifically looking for any file that disappears relative to one parent, since a clean merge’s absence of conflict markers never checks for this kind of cross-branch rename.
- Use a rename-detection-aware diff, or review the actual commit history of a deleted file on each branch, before merging two long-lived branches that both touched the same area of the codebase, so an intentional rename on one side is caught before the merge silently erases it.
- Run the test suite, and specifically any test that loads configuration or data from a file path, immediately after a merge that touched shared infrastructure files, rather than trusting a conflict-free merge to mean every file ended up where it needed to be.
⚠️ Why This Is Easy to Miss
- A merge with zero conflicts reads as the safe, boring outcome – the kind every developer wants to see – so there is no natural prompt to go back and double-check individual files once the merge command itself reports success with nothing to resolve.
- The missing file only causes a visible failure once something tries to load it at runtime, which can be long after the merge itself, especially if the file is only read in a code path or environment that isn’t exercised by routine local testing.
Git calls a merge clean when both branches agree – it never asks whether what they agree on is actually what either branch meant.





