How could I force mergetool GUI (KDiff3) to be always shown?

Git has --auto hard coded as a command-line option to KDiff3, which causes the GUI not to show up if all conflicts are auto-resolvable by KDiff3. In the KDiff3 settings you can specify command line options to ignore, but putting --auto there did not work for me.

As a workaround I configured my own variant of KDiff3 as the merge tool:

git config --global mergetool.kdiff3NoAuto.cmd "kdiff3 --L1 \"\$MERGED (Base)\" --L2 \"\$MERGED (Local)\" --L3 \"\$MERGED (Remote)\" -o \"\$MERGED\" \"\$BASE\" \"\$LOCAL\" \"\$REMOTE\""

This is very similar to what Git uses by default for KDiff3, but without the --auto flag.

Now you can call git mergetool -t kdiff3NoAuto or configure kdiff3NoAuto as mergetool globally and KDiff3 will always show up when resolving conflicts.

Regarding the second part of your question, if you really want to disable any automatic resolving, just add --qall to the kdiff3 command line above. But then you have to manually resolve all changes in the file manually, even the ones that did not result in a Git conflict. The best scenario would be: KDiff3 shows how Git merged the files and leaves the conflicts open for the user to choose.

Leave a Comment