Tuesday, April 6, 2010

Using Beyond compare3 as Git diff tool under Cygwin

在Cygwin下使用Beyond compare3(BC3)作用Git的diff工具
分两步走~


step 1.
create new .sh file as Git's diff warpper.
#!/bin/sh
/cygdrive/c/Program\ Files\ \(x86\)/Beyond\ Compare\ 3/BCompare.exe "d:/programs/cygwin$2" "$5"


** please notice here, you need specially make a full path of $2, since BC3 will not find your tmp file under Cygwin path. **
** 注意这里的两个路径,第二个是本地文件,因为是相对路径,BC3可以找到,但第一个是绝对路径指向/tmp/xxx,所以我们要特别指定在windows下的真实路径,而不是cygwin的路径,所以我加上了d:/programs/cygwin。

step 2.
Add this line to .bashrc and run it to configure your Git gloabl variable.
git config --global diff.external /home/z33/git-diff-wrapper.sh


Now you can try git diff whatever your file.