Search code examples
gitkdiff3mergetool

Auto merge using regex


KDiff3 has option automatic merge regular expression. In case of conflict KDiff3 resolve it automaticlly using REMOTE changes. But I want to resolve it using LOCAL changes.

My question: Is there possibility to resolve conflict automatically by some regex using LOCAL changes?


Solution

  • I have found the solution.

    Remote changes were applied because GitExtensions set Local as B (second file) and Remote as C (third file). But in documentation of KDiff3 you can read

    KDiff3 offers automatic merge for these items. For simple lines that match the "Auto merge regular expression"-option in all input-files KDiff3 will choose the line from B or - if available - from C
    

    I ran KDiff3 in command line and set file with local changes as third argument, file with remote changes as second argument.

    kdiff3.exe  BASE_FILE  REMOTE_FILE  LOCAL_FILE  -m  -o  OUTPUT_FILE
    

    Now, conflicts are resolved using LOCAL changes