Github: Why revising a csv file in a branch results in a conflicting merge?

48 Views Asked by At

I'm sorry for this very basic question but I can't understand why revising a csv file that I pulled from the master would create a conflict in my pull request.

What happened is, I have a collaborative repo with main branch which contains a file.csv. Collaborator A created branch A from main and revised the file.csv then merged successfully into main. I (collaborator B) created a branch B from main (before person A merged) and also revised file.csv. When I pulled a request to merge into main, I got a conflict because person A already merged in their pull request that changed file.csv. That I can understand.

What I don't understand is when I then pulled file.csv from main (already revised from person A's merge) and revised it, then pulled request to merge it to main again but still got a conflict. Why is that?

1

There are 1 best solutions below

0
Jaredo Mills On

Examining the conflict should tell you why it happened. It must be because the same line, or adjacent lines were changed in both A and B since the common ancestor (the earliest fork point, A's branch point in this case).

The csv format is not treated any differently than a text file, so it matters for context if one branch inserted rows where the other deleted some.

It can be useful to set the option merge.conflictStyle=diff3 which adds to the conflict the original text, your change, and their change. See man git-config