我无法让 git diff 使用 opendiff
我想使用 opendiff 作为 git diff 的默认 diff 工具。这曾经有效,但由于某种原因停止工作。 我正在使用一个脚本:
echo opendiff $2 $5 > opendiff-git.sh
它在 .gitconfig 中设置:
[diff]
external = ~/opendiff-git.sh
这最近对我不起作用。怎么了?
更新: 当我克隆一个新的存储库时,一切正常!奇怪的!
I want to use opendiff as default diff-tool for git diff. This used to work but for some reason stopped working.
I'm using a script:
echo opendiff $2 $5 > opendiff-git.sh
which is set in .gitconfig:
[diff]
external = ~/opendiff-git.sh
This stopped working for me lately. What is wrong?
Update:
When I cloned a new repository everything worked fine! Strange!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在尝试将 opendiff 设置为我的 git diff & 时发现了这个问题。合并工具。
奇怪的是,当我使用 echo opendiff $2 $5 > 时, opendiff-git.sh 创建一个脚本,该脚本不包含参数占位符 $2 $5 我手动添加它们,它开始工作!
这个命令
产生了 opendiff-git.sh 文件,其中包含
我手动添加了两个参数占位符 $2 $5
按照 knittl 的建议使 shell 脚本可执行
并且它有效!
I found this question while I was trying to set opendiff as my git diff & merge tool.
Weird thing is that when I used the echo opendiff $2 $5 > opendiff-git.sh to create a script the script did not contain the argument place holders $2 $5 I added them in manually and it started working!
This command
Resulted in opendiff-git.sh file containing
I added the two argument placeholders $2 $5 manually
Made the shell script executable as suggested by knittl
And it works!
确保您的 opendiff-git.sh 文件已设置可执行位:
make sure your
opendiff-git.sh
file has its executable bits set:您现在可以使用 git config 指定默认工具。要使用 FileMerge,即
opendiff
,请运行:如果您查看
~/.gitconfig
文件,您现在应该看到:它现在应该可以工作了。
You can now specify a default tool using
git config
. To use FileMerge, i.e.opendiff
, run:If you view your
~/.gitconfig
file, you should now see:It should now work.