Git Merge常用解决冲突工具配置
- 使用TortoiseGitMerge(或TortoiseSVN)
1.使用TortoiseGit
下载地址:https://tortoisegit.org/
全局.gitconfig中配置(即C盘用户目录下)
[diff]
tool = tortoisediff
[difftool]
prompt = false
[merge]
tool = tortoisemerge
[mergetool]
prompt = false
keepBackup = false
[difftool "tortoisediff"]
cmd = \""c:/Develop/TortoiseGIT/bin/TortoiseGitMerge.exe"\" -mine "$REMOTE" -base "$LOCAL"
[mergetool "tortoisemerge"]
cmd = \""c:/Develop/TortoiseGIT/bin/TortoiseGitMerge.exe"\" -base "$BASE" -theirs "$REMOTE" -mine "$LOCAL" -merged "$MERGED"
2.使用 TortoiseSVN
下载地址:
https://tortoisesvn.net/index.zh.html
配置类似TortoiseGitMerge,不再赘述
[========]
-
使用P4Merge
下载地址:
https://www.perforce.com/
下载Helix Visual Client (P4V)
全局中配置:
[diff]
tool = p4merge
[difftool]
prompt = false
[merge]
tool = p4merge
[mergetool]
prompt = false
keepBackup = false
[========]
-
使用DiffMerge
下载:
http://www.sourcegear.com/
配置:
1.在Git\cmd目录下创建两个txt文件
- git-difftool-diffmerge-wrapper.txt:
# 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.txt:
# 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"
然后把两个txt后缀都改为.sh
2.全局.gitconfig中配置(即C盘用户目录下)
[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"
当merge出现冲突的时候,输入命令:
git mergetool
即可打开工具
[========]
以上默认都自动配置了系统变量.如果没有,请自行配置.
使用时别忘了修改配置中工具的路径
附录:
如果报ssl认证相关错误,则在命令行中输入以下内容并回车即可:
git config --global http.sslVerify false
或者全局中直接配置:
[http]
sslVerify = false