Say I have two processes that append lines to copies of the same original (parent) file (copy_A
and copy_B
). If I diff
these copies, can diff
ever conclude that we have a conflict? (i.e. can it ever conclude that copy_A
and copy_B
made edits to the same line)?
Note that none of the processes remove lines, they both add lines, but I wonder if diff
(specifically git
) could ever conclude that they were editing the same line (as opposed to concluding that they both added different lines)
In my case specifically, I am working with csv
files (both processes append records to their own copies of a csv
file, i.e. the original csv
file being the same at the beginning), and I am hoping to git merge these csv files hopefully automatically without conflicts. Can I make that assumption?
Update:
Assuming that both processes are appending lines to the same file on their own branches that we hope to merge onto master at some point. Is there any way to tell git (diff) that they both correspond to additions to have it automatically merge the changes (adding entries perhaps in block, e.g. all of A's additions followed by B's additions)
Best Answer
Write a custom merge driver as explained in strategy for git and append-mostly files.
This way you can specify that the way to merge files is to append them, rather than to stop and ask the user to resolve the conflict that is trivially solved by appending.