git difftool配置beyond compare
1.下载
http://www.sourcegear.com/diffmerge/downloads.php
下载的时候要下载Installer版的
2.配置
git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd 'diffmerge "$LOCAL" "$REMOTE"'
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd 'diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"'
git config --global mergetool.diffmerge.trustExitCode true
3.使用
git difftool
在git项目下执行git difftool,出现如下报错
/Library/Developer/CommandLineTools/usr/libexec/git-core/mergetools/diffmerge: line 121: diffmerge: command not found
解决方法
ln -s /Applications/DiffMerge.app/Contents/Resources/diffmerge.sh /usr/local/bin/diffmerge
4.下载beyond compare
设置为默认的merge工具
git config --global merge.tool bc
设置为默认的diff工具
git config --global diff.tool bc
在使用git megetool 来解决冲突后,会生成 备份文件 (*.orig),大多数情况下不是我们想要的,在终端中配置
git config --global mergetool.keepBackup false
这样就不会每次在解决冲突后生成对应的 .orig文件了

浙公网安备 33010602011771号