Git Merge常用解決沖突工具配置
- 使用TortoiseGitMerge(或TortoiseSVN)
1.使用TortoiseGit
下載地址:https://tortoisegit.org/
全局.gitconfig中配置(即C盤(pán)用戶目錄下)
[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
配置類(lèi)似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目錄下創(chuàng)建兩個(gè)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"
然后把兩個(gè)txt后綴都改為.sh
2.全局.gitconfig中配置(即C盤(pán)用戶目錄下)
[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"
當(dāng)merge出現(xiàn)沖突的時(shí)候互躬,輸入命令:
git mergetool
即可打開(kāi)工具
[========]
以上默認(rèn)都自動(dòng)配置了系統(tǒng)變量.如果沒(méi)有,請(qǐng)自行配置.
使用時(shí)別忘了修改配置中工具的路徑
附錄:
如果報(bào)ssl認(rèn)證相關(guān)錯(cuò)誤,則在命令行中輸入以下內(nèi)容并回車(chē)即可:
git config --global http.sslVerify false
或者全局中直接配置:
[http]
sslVerify = false