Kdiff3 won't open with mergetool command

后端 未结 5 1974
我在风中等你
我在风中等你 2021-02-07 01:26

I have conflicts, so I type:

git mergetool

I then get a message saying:

Hit return to start merge resolution tool

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-07 01:31

    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.

    We can change this default behavior by setting:

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

    which result in the ~/.gitconfig file (or you can directly modify the file):

    [merge]
            tool = kdiff3
    [mergetool "kdiff3"]
            path = C:/Program Files/KDiff3/kdiff3.exe
            trustExitCode = false
            cmd = \"/c/Program Files/KDiff3/kdiff3.exe\" --L1 \"$MERGED (Base)\" --L2 \"$MERGED (Local)\" --L3 \"$MERGED (Remote)\" -o \"$MERGED\" \"$BASE\" \"$LOCAL\" \"$REMOTE\"
    [diff]
            guitool = kdiff3
    [difftool "kdiff3"]
            path = C:/Program Files/KDiff3/kdiff3.exe
            trustExitCode = false
    

    In this way, the kdiff3 will alway open whether there is still unsolved conflicts left.

    Ref: https://stackoverflow.com/a/15813064/2303761

提交回复
热议问题