beyond compare 与git diff整合

这两天花了点时间最终在Window和Mac上把Beyong Compare和git整合好。当中遇到到非常多坑,如今把这些都分享出来。希望对大家有帮助。
首先如果你已经装好了Beyong Compare。
然后在~/bin/文件夹下新建一个git-diff-wrapper.sh
window系统的git bash的git-diff-wrapper.sh
#!/bin/sh
# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode
"D:/tools/Beyond Compare 2/BC2.exe" "$2" "$5" | cat

mac系统的git-diff-wrapper.sh 

#/bin/sh
# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode
bcompare "$2" "$5"|cat

注意:你在mac系统中装了beyong compare后须要在菜单条点击“Install Command Line Tools”把它增加到命令行。
Beyond Compare Pro for Mac 4.0.2 破解版下载

在用户文件夹~下改动.gitconfig文件

[user]
name = hudashi
email = hudashi@gmail.com
[diff]
external = ~/bin/git-diff-wrapper.sh

最后就git diff就ok了。
注意我们在Mac上执行git diff时,因为系统要保存历史文件到暂时文件夹再进行比較,而在保存到暂时文件夹又须要非常高的权限。所以我在git  diff前加了sudo才干执行成功。即sudo git diff.
关于git diff的很多其它内容请參考《git diff简单介绍
原文地址:https://www.cnblogs.com/yutingliuyl/p/6727084.html