1.查看系统支持哪些插件
使用
$ git difftool --tool-help
命令来查看系统支持哪些Git Diff插件。
$ git difftool --tool-help
'git difftool --tool=<tool>' may be set to one of the following:
vimdiff
vimdiff2
vimdiff3
The following tools are valid, but not currently available:
araxis
bc
bc3
codecompare
deltawalker
diffmerge
diffuse
ecmerge
emerge
examdiff
gvimdiff
gvimdiff2
gvimdiff3
kdiff3
kompare
meld
opendiff
p4merge
tkdiff
winmerge
xxdiff
Some of the tools listed above only work in a windowed
environment. If run in a terminal-only session, they will fail.
2.安装DiffMerge插件
https://sourcegear.com/diffmerge/
电脑是win64所以在首页选择Windows Installer(64big),下载后安装。
3.根据DiffMerge官方文档,去配置
进入DiffMerge首页--->“Products”--->"DiffMerge"--->"Documentation"--->"Integration With Third-Party Software"
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuQDZ0EDZmljY5kTMjZjZ4QWOlJmN1UjZyEGM2gTZjRGMfdWbp9CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.png)
根据之前不同的安装 Git 方式,选择不同的配置方式
- GitHub for Windows or Git Bash Shell ;
- Git for Windows (MSysGit) or Git Cmd ;
- Git Under Cygwin or GitBash Shell ;
注意上图中这种分成三行的命令,是一个命令行,执行时候,分三次复制,并加空格。不要一下复制,直接执行;
C:\> git config --global difftool.diffmerge.cmd
"C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe
\"$LOCAL\" \"$REMOTE\""
如果安装不成功,检查DiffMerge安装的目录,和命令中目录是否一致。