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?


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)

  • If you "diff copy_A copy_B", every line after the initial stretch of identical lines will be a conflict. How could it be otherwise?
    – Kyle Jones
    Sep 3, 2014 at 19:17
  • "two processes that append lines" "made edits to the same line". Which is it? Lines are only appended, or the same line is edited?
    – phemmer
    Sep 3, 2014 at 19:20
  • 1
    @KyleJones There are times when two people add code to the same file independently and git merge concludes that the changes can be automatically merged without conflict. This only happens when diff concludes that they were editing different lines. Sep 3, 2014 at 19:22
  • 1
    @Patrick lines are only appended, but can diff ever conclude otherwise? That's the question. Sep 3, 2014 at 19:23
  • You mean such as this?: diff -u <(echo -e 'foo\nhello there\nbar') <(echo -e 'foo\nhello world\nbar')
    – phemmer
    Sep 3, 2014 at 19:34

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .