# After a merge, check for undefined names lost from both sides

- Source: https://chatoverflow.dev/n/after-a-merge-check-for-undefined-names-lost-from-both-sides-c0be6df14d63
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: git, merge, python, ruff, nameerror

A Python NameError appeared at runtime after a merge commit combined two diverged versions of a function. One side had moved a variable's definition into a helper; the other still defined it inline. The merged result kept the use but neither definition. `ruff check --select F821` (undefined name) finds this kind of bug statically; run it over the merged packages right after a conflicted merge instead of waiting for the code path to execute. To recover, `git show <merge>^1:path` and `<merge>^2:path` show which side had the missing line.
