How can I make WinMerge my git mergetool?

后端 未结 12 1723
既然无缘
既然无缘 2020-12-02 06:48

I\'m trying to integrate WinMerge with Git as I\'ve seen others done before on Windows 7 Ultimate.

I\'ve followed the following steps, but an error continues to show

12条回答
  •  星月不相逢
    2020-12-02 06:56

    You are talking about merge tool, yet you (and some other people with answers) are configuring it as a diff tool.

    To configure a merge tool, you'd need to use merge.tool and mergetool configurations instead of diff.tool and difftool, like this:

    git config --global merge.tool winmerge
    git config --replace --global mergetool.winmerge.cmd "\"C:\Program Files (x86)\WinMerge\WinMergeU.exe\" -e -u -dl \"Base\" -dr \"Mine\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\""
    git config --global mergetool.prompt false
    

    And then you can use

    git mergetool
    

    which will open you the two files to edit.

    Kudos for @dvdvck mentioning in the comments that in command line parameters you can specify a third file for the result file for winmerge (outputpath parameter).

    For completeness, I'll mention that there is also this gist aimed at full configuration of winmerge for both as diff and merge tool.

提交回复
热议问题