.gitattributes & individual merge strategy for a file

I had the same error and it can be solved just defining an “ours” merge driver in .git/config:

[merge "ours"]
    name = "Keep ours merge"
    driver = true

Since true always return 0 the temporary file holding the current state will not be changed and will stay as the final version.

You can read more about merge driver in here: http://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_defining_a_custom_merge_driver

Addendum:

This works any time the driver is actually called and this seems to occur only when there are commits changing the same files (git the merge attribute). If there are changes in a single branch the driver is not going to be called.

Leave a Comment