0

We have a few files (such as message catalogs) where the line order is not meaningful, and the practice is always to append new lines. This causes git conflicts: git has no info on the proper order. Marking that as a conflict is, of course, the right thing in general, but as I say for these files line order is meaningless.

Is there some setting to tell git "just append"? Or some other discipline that would reduce these conflicts?

jackr
  • 1,407
  • 1
  • 14
  • 29

1 Answers1

1

Here are two methods that have worked for me in the past

  1. sort lines alphabetically and then insert new lines as well in alphabetical order. This is helpful not only because two team members would often then not update the same line, but helps for when looking for other properties later as it's neatly organized in alphabetical order.
  2. If there's just 2 of you, you can have a convention where 1 of you just adds lines at the top and the other adds lines at the bottom. Then just try to keep the convention.
Keif Kraken
  • 9,500
  • 1
  • 10
  • 12
  • Someone did write a git merge driver that acts as a sort of union merge (search for "union merge" to see how this is defined) with append-only behavior. However, I'd encourage approach #1 here as it solves another problem that occurs with these, which is duplication (multiple people add the same message translations, or variants of them, without realizing it). – torek Oct 04 '16 at 22:45