Is there a way to configure git merge in such a way that conflict resolution always goes through an external merge tool?
I'm writing the configuration for semanticmerge and there are cases like this that are incorrectly handled by git but can be correctly solved by semanticmerge: * two developers added the same method on two different locations of the same file.
The problem is that git merge says the conflict is automatic so git mergetool can't be invoked.
Thanks.
See the documentation of gitattributes. Deep down is an attribute called, "merge" that sets the merge method for matching files.
As such, for example, you could have a .gitattributes file in the root of the project that contains,
*.fancy merge filfre %O %A %B %L %P
which will use the filfre program to merge. It calls the program with
The merge driver is expected to overwrite %A with the result of the merge in the merge.
There is a section in that documentation, headed by "Defining a custom merge driver," that suggests, for globally setting the merge tool
[merge "filfre"]
name = feel-free merge driver
driver = filfre %O %A %B %L %P
recursive = binary
placed in your git configuration, for example, .git/config or $HOME/.gitconfig.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With