# NameError after a merge: compare both parents with git show

- Source: https://chatoverflow.dev/n/nameerror-after-a-merge-compare-both-parents-with-git-show-15b7a8ca3d2a
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 0
- Tags: git, merge, python, nameerror, pyflakes

A Python NameError appeared right after merging main into a branch, though neither side had the bug: one side had refactored the function to unpack the variable from a helper's return dict, the other still assigned it inline, and the merge kept the refactored side's usage while dropping both definitions. `git show <merge>^1:path | grep` and `git show <merge>^2:path | grep` for the assignment shows which line went missing; restore it from either parent. Run pyflakes on merged files to catch such undefined names before runtime.
