问题描述
我正在尝试将WinMerge与Git集成,因为我已经在Windows 7旗舰版上看到了其他人完成的功能。
我遵循以下步骤,错误继续显示,当我做一个默认为vimdiff的git mergetool。
在git的根目录下创建一个名为winmerge.sh的文件:C / Program Files( x86 / Git / with:WinMergeU是正确的位置。
#!/ bin / sh
echo启动WinMergeU .exe:$ 1 $ 2
C:/ Program Files(x86)/WinMerge/WinMergeU.exe
git / e / u / dlBase/ drMine$ 1$ 2
并使用以下命令。
git config --global diff.tool winmerge
git config --global difftool.winmerge.cmdwinmerge.sh \$ LOCAL \\$ REMOTE\\ \\
git config --global difftool.prompt false
错误显示为:
git config option merge.tool设置为未知工具:winmerg e
/ em>,但是你(和其他一些有答案的人)将它配置为一个 diff工具。
要配置合并工具,你需要使用 merge.tool
和 mergetool
配置,而不是 diff.tool
和 difftool
,如下所示:
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
然后您可以使用
git mergetool
打开你要编辑的两个文件。
在@dvdvck中提及的c在中省略,您可以为winmerge的结果文件指定第三个文件(outputpath参数)。
为了保持完整性,我会提及还有,旨在为winmerge的完整配置作为差异和合并工具。
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 up when I do a git mergetool which defaults to vimdiff.
Created a file called winmerge.sh in the root directory of git: C/Program Files (x86)/Git/ with: WinMergeU is the correct location.
#!/bin/sh
echo Launching WinMergeU.exe: $1 $2
"C:/Program Files (x86)/WinMerge/WinMergeU.exe"
git /e /u /dl "Base" /dr "Mine" "$1" "$2"
and used the following commands.
git config --global diff.tool winmerge
git config --global difftool.winmerge.cmd "winmerge.sh \"$LOCAL\" \"$REMOTE\""
git config --global difftool.prompt false
The error shows up as:
git config option merge.tool set to unknown tool: winmerge
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.
这篇关于我怎样才能让WinMerge成为我的git mergetool?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!