After a merge, the same function appears twice in the file.
IntermediateTroubleshootingMerge and Rebase Problems
Answer
Likely causes → Both branches added the same function at different places (no textual conflict), or a resolution kept both sides.
Diagnose →
git diff <merge-sha>^1 <merge-sha> -- file
git log --oneline -S'def calculate_tax' -- file
Fix → Remove the duplicate, run tests and linters, and commit. Check the other branch's version to see which has the newer logic.
Prevent → Run the build and tests on the merge result in CI. Duplicate definitions are often caught by a compiler or linter.
More on Merge and Rebase Problems
Production failed to start, and the file contains `<<<<<<< HEAD` lines that were committed.Beginner`error: you need to resolve your current index first`Beginner`fatal: You have not concluded your merge (MERGE_HEAD exists).`BeginnerRebase stops: `error: could not apply 1a2b3c4... Add retry` and later `No changes - did you forget to use 'git add'?`Intermediate`fatal: It seems that there is already a rebase-merge directory, and I wonder if you are in the middle of another rebase.`Intermediate`CONFLICT (modify/delete): config/old.yml deleted in HEAD and modified in feature.`Intermediate