我成功地让git启动Beyond Compare 3作为diff工具,但是当我做差异时,我正在比较的文件没有被加载.只加载了最新版本的文件而没有其他内容,因此Beyond Compare右侧窗格中没有任何内容.
我正在使用带有Beyond Compare 3的Cygwin运行git 1.6.3.1.我已经设置了超出比较,因为他们在他们的网站的支持部分建议用这样的脚本:
#!/bin/sh # diff is called by git with 7 parameters: # path old-file old-hex old-mode new-file new-hex new-mode "path_to_bc3_executable" "$2" "$5" | cat
有没有其他人遇到过这个问题并知道解决方案?
编辑:
我已经按照VonC的建议,但我仍然遇到与以前完全相同的问题.我是Git的新手,所以也许我没有正确使用差异.
例如,我试图用这样的命令在文件上看到diff:
git diff main.css
然后将打开Beyond Compare,只显示左窗格中的当前main.css,右窗格中没有任何内容.我希望在左窗格中看到我当前的main.css与HEAD相比,基本上我最后提交的内容.
我的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 "c:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat
我的git配置对于Diff看起来像这样:
[diff] external = c:/cygwin/bin/git-diff-wrapper.sh
yehnan.. 137
我不使用额外的包装.sh文件.我的环境是Windows XP,cygwin上的git 1.7.1和Beyond Compare 3.以下是我的.git/config文件.
[diff] tool = bc3 [difftool] prompt = false [difftool "bc3"] #use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path, because bc3 is a windows software cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$(cygpath -w $LOCAL)" "$REMOTE" [merge] tool = bc3 [mergetool] prompt = false [mergetool "bc3"] #trustExitCode = true cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
然后,我使用$ git difftool进行比较,并使用$ git mergetool进行合并.
关于trustExitCode:对于自定义合并命令,请指定合并命令的退出代码是否可用于确定合并是否成功.如果未设置为true,则检查合并目标文件时间戳,如果文件已更新,则假定合并已成功,否则将提示用户指示合并成功.
我不使用额外的包装.sh文件.我的环境是Windows XP,cygwin上的git 1.7.1和Beyond Compare 3.以下是我的.git/config文件.
[diff] tool = bc3 [difftool] prompt = false [difftool "bc3"] #use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path, because bc3 is a windows software cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$(cygpath -w $LOCAL)" "$REMOTE" [merge] tool = bc3 [mergetool] prompt = false [mergetool "bc3"] #trustExitCode = true cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
然后,我使用$ git difftool进行比较,并使用$ git mergetool进行合并.
关于trustExitCode:对于自定义合并命令,请指定合并命令的退出代码是否可用于确定合并是否成功.如果未设置为true,则检查合并目标文件时间戳,如果文件已更新,则假定合并已成功,否则将提示用户指示合并成功.
感谢Posh-Git的作者@dahlbyk发布他的配置作为要点.它帮助我解决了配置问题.
[diff] tool = bc3 [difftool] prompt = false [difftool "bc3"] cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" [merge] tool = bc3 [mergetool] prompt = false keepBackup = false [mergetool "bc3"] cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\" trustExitCode = true [alias] dt = difftool mt = mergetool
为Beyond Compare 2运行以下命令:
git config --global diff.tool bc2 git config --global difftool.bc2.cmd "\"c:/program files (x86)/beyond compare 2/bc2.exe\" \"$LOCAL\" \"$REMOTE\"" git config --global difftool.prompt false
为Beyond Compare 3运行以下命令:
git config --global diff.tool bc3 git config --global difftool.bc3.cmd "\"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"" git config --global difftool.prompt false
然后用 git difftool
官方文件对我有用
这是我的配置文件.这需要一些摔跤,但现在它正在发挥作用.我正在使用Windows服务器,msysgit和超越比较3(显然是x86版本).你会注意到我不需要指定任何参数,我使用"path"而不是"cmd".
[user] name = PeteW email = petew@petew.com [diff] tool = bc3 [difftool] prompt = false [difftool "bc3"] path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe [merge] tool = bc3 [mergetool] prompt = false keepBackup = false [mergetool "bc3"] path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe trustExitCode = true [alias] dt = difftool mt = mergetool