我已经成功地让 git 启动 Beyond Compare 3 作为 diff 工具,但是,当我进行 diff 时,我正在比较的文件没有被加载。仅加载该文件的最新版本,没有加载其他任何内容,因此 Beyond Compare 的右侧窗格中没有任何内容。
我正在使用 Cygwin 和 Beyond Compare 3 运行 git 1.6.3.1。我已经按照他们在其网站的支持部分中建议的那样设置了 Beyond Compare,脚本如下:
#!/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
还有其他人遇到过这个问题并知道解决方案吗?
Edit:
我已遵循 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
我不使用额外的包装器 .sh 文件。我的环境是Windows XP,cygwin上的git 1.7.1,Beyond Compare 3。以下是我的.git/配置 file.
[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 合并工具合并。
About 信任退出代码:
对于自定义合并命令,指定是否可以使用合并命令的退出代码来确定合并是否成功。如果未将其设置为 true,则检查合并目标文件时间戳,如果文件已更新,则假定合并已成功,否则将提示用户指示合并成功。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)