How can I make WinMerge my git mergetool?

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

    I originally upvoted @CapinWinky's answer for using WinMerge from SourceTree. That answer is still valid, but WinMerge now also supports a three-way merge which needs additional parameters.

    Within the SourceTree Options dialog I chose "Custom" as the Merge Tool, entered the command as:

    C:\Program Files\WinMerge\WinMergeU.exe
    

    and the Arguments as:

    -u -fm -wl -wr -dl Remote_RO -dm Local_Merged -dr Base_RO $REMOTE $LOCAL $BASE -o $MERGED
    

    It doesn't seem to be necessary to enclose the remote/local/base parameters in quotes to cater for paths with spaces in them any more.

    This configuration is for using the middle pane as the merged output file.

    Command line reference

    I had the problem that when trying to merge, WinMerge wouldn't open. Sourcetree starts Git to open your tool of choice. When using Sourcetree's custom option, your git config file (e.g. C:\Users\Me\.gitconfig) is modified to add a new Merge tool called "sourcetree" and the Git command includes --tool=sourcetree . At some point the .gitconfig file hadn't been updated correctly and I had two 'cmd' lines in that section, one being broken:

    [mergetool "sourcetree"]
        cmd = 'C:/Program Files/WinMerge/WinMergeU.exe' -u -fm -wl -wr -dl Remote_RO -dm Local_Merged -dr Base_RO $REMOTE $LOCAL $BASE -o $MERGED
        trustExitCode = true
        cmd = 'C:/Program '
    

    Manually fixing up the .gitconfig file sorted the problem.

提交回复
热议问题