原文:http://sinojelly.blog.51cto.com/479153/633495
配置方法
建议配置在~/.gitconfig中。
Linux下
[diff]
tool = bc3
[difftool]
prompt = false
[merge]
tool = bc3
[mergetool]
prompt = false
tool = bc3
[difftool]
prompt = false
[merge]
tool = bc3
[mergetool]
prompt = false
[diff]
tool = jellybc3
[difftool]
prompt = false
[difftool "jellybc3"]
#use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path, because bc3 is a windows software
cmd = \" /cygdrive /c /program files /beyond compare 3 /bcomp.exe\" \"$(cygpath -w $LOCAL)\" \"$REMOTE\"
[merge]
tool = jellybc3
[mergetool]
prompt = false
[mergetool "jellybc3"]
#trustExitCode = true
cmd = \" /cygdrive /c /program files /beyond compare 3 /bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\" \"$MERGED\"
tool = jellybc3
[difftool]
prompt = false
[difftool "jellybc3"]
#use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path, because bc3 is a windows software
cmd = \" /cygdrive /c /program files /beyond compare 3 /bcomp.exe\" \"$(cygpath -w $LOCAL)\" \"$REMOTE\"
[merge]
tool = jellybc3
[mergetool]
prompt = false
[mergetool "jellybc3"]
#trustExitCode = true
cmd = \" /cygdrive /c /program files /beyond compare 3 /bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\" \"$MERGED\"
注意:
1、diff工具的命名,如果用bc3,那么git会采用它内置的对bc3的理解来进行调用,不会调用cmd指定的。
Linux上使用内置的比较方便,但cygwin上,$LOCAL不转换为Windows路径,会发现BC只打开了一个文件。
2、注意引号需要转义,否则git调用时会出错。
3、根据上面的推理,如果在Linux下配置,应该只需要配置diff.tool为bc3,并且把bc可执行文件路径加入path环境变量即可(也可以配置在difftool.bc3.path中)。merge也是类似。
git difftool
git mergetool
BC官方网站关于集成版本管理系统的介绍(必要时可参考,比如上面的介绍并不适合你所用的git版本时)
GIT官方网站的帮助(非常有用)