這兩天花了點時間終于在Window和Mac上把Beyong Compare和git整合好,其中遇到到很多坑,現(xiàn)在把這些都分享出來,希望對大家有幫助。
首先假設你已經(jīng)裝好了Beyong Compare。
然后在~/bin/目錄下新建一個git-diff-wrapper.sh
window系統(tǒng)的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系統(tǒng)的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系統(tǒng)中裝了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時,由于系統(tǒng)要保存歷史文件到臨時目錄再進行比較,而在保存到臨時目錄又需要很高的權限。所以我在git diff前加了sudo才能執(zhí)行成功。即sudo git diff.
關于git diff的更多內(nèi)容請參考《git diff簡介》
回復 更多評論