do you have any text files that are nothing more then an "unordered set of 
More specifically, files where:
* location/ordering of lines is not (very) important or relevant
* new lines can be added anywhere within the file, on arbitrary locations
* deleting a line means "I want this line gone from the file, wherever it is"

I surely have them.  Simple todo lists, notes, shell history, GTD inbox files, 
browser history, etc

If, like me, you try maintaining and synchronizing them on multiple systems, 
through git,
you'll often have conflicts because git will think - as is the case with source 
code text files - additions and deletions of line are more meaningful then they 
really are: it will generate conflicts when line deletions/additions happen too 
closely to each other.  However, based on the above properties, they can be 
merged automatically by replicating deletions - by finding the right line(s) no 
matter the position in the file - and adding all added lines from the parents - 
if they are not yet in the file, again independent of the position in the file.

I'm considering writing my own git merge driver for this use case.
There is the union merge driver which in my limited testing does pretty well at 
handling this use case - except for the "delete the line.. wherever it is" 
(which, in practice is pretty much the same location in both files anyway) 
case, and when the same line is added in both parents, it will be appear twice. 
 (not ideal, but this happens rarely and files like todo lists and such get 
cleaned up manually regularly anyway, so it should not be an issue)

Anyone experienced with this use case?
If you want to try the union merge driver, put this in your <git 
<filename> merge=union
(not "merge = union", that won't work!)

I might write my own merge driver for this use case in python, unless anyone 
has a better idea.

vcs-home mailing list

Reply via email to