当我输入时git diff
,我想用我选择的视觉差异工具(Windows上的SourceGear"diffmerge")查看输出.如何配置git来执行此操作?
我成功地让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
Run Code Online (Sandbox Code Playgroud)
有没有其他人遇到过这个问题并知道解决方案?
编辑:
我已经按照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
Run Code Online (Sandbox Code Playgroud)
我的git配置对于Diff看起来像这样:
[diff]
external = c:/cygwin/bin/git-diff-wrapper.sh
Run Code Online (Sandbox Code Playgroud)