How can I make WinMerge my git mergetool?

后端 未结 12 1703
既然无缘
既然无缘 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:57

    Entering the settings via the command line has been covered by other answers. The .gitconfig file for full 3-way merging with WinMerge could be configured like this (this example is from Windows):

    [merge]
        tool = WinMerge
    
    [mergetool "WinMerge"]
        cmd = \"C:\\Program Files\\WinMerge\\WinMergeU.exe\" -e -u -dl \"Local\" -dm \"Base\" -dr \"Remote\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" -o \"$MERGED\"
        trustExitCode = true
        keepBackup = false
    
    [diff]
        tool = WinMerge
    
    [difftool "WinMerge"]
        cmd = \"C:\\Program Files\\WinMerge\\WinMergeU.exe\" -e -u -dl \"Old $BASE\" -dr \"New $BASE\" \"$LOCAL\" \"$REMOTE\"
        trustExitCode = true
    

    Flag information:

    • /e - Allows WinMerge to be closed via a single press of the 'esc' key.
    • /u - Prevents WinMerge from logging the files in the recently used list.
    • /dl, /dm, and /dl - Descriptions for Left, Middle, and Right panes.
    • /o - The output file. Saving ANY pane will output that pane's contents to the output file.

    trustExitCode = true tells git to accept the output without further prompt.

    keepBackup = false will automatically delete the automatically generated *.orig files.

    Note: The $BASE and $MERGE variables when using difftool both simply contain the filename.

提交回复
热议问题