Git Windows下配置Merge/Diff工具DiffMerge
参考:Git Windows下配置Merge工具DiffMerge
-
下载DiffMerge
DiffMerge下载地址
创建启动DiffMerge脚本
1)在Git的安装路径的\cmd路径下创建以下两个脚本,注意安装路径,见图
git-difftool-diffmerge-wrapper.sh
# place this file in the Windows Git installation directory /cmd folder
# be sure to add the ../cmd folder to the Path environment variable
# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode
"C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe" "$1" "$2" | cat
git-mergetool-diffmerge-wrapper.sh
# place this file in the Windows Git installation directory /cmd folder
# be sure to add the ../cmd folder to the Path environment variable
# passing the following parameters to mergetool:
# local base remote merge_result
"C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe" "$1" "$2" "$3" --result="$4" --title1="Mine" --title2="Merge" --title3="Theirs"
2)将\cmd设置环境变量,方便找
3)黑掉Git配置文件
找到.gitconfig文件(路径在Windows“用户”路径下),
相关内容用下面的替换
[merge]
tool = diffmerge
[diff]
tool = diffmerge
[mergetool]
keepBackup = false
[mergetool "diffmerge"]
cmd = git-mergetool-diffmerge-wrapper.sh "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
[difftool "diffmerge"]
cmd = git-difftool-diffmerge-wrapper.sh "$LOCAL" "$REMOTE"
4)解决中文乱码问题