我无法让 git diff 使用 opendiff

发布于 2024-11-16 00:21:17 字数 288 浏览 5 评论 0原文

我想使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

花开柳相依 2024-11-23 00:21:17

我在尝试将 opendiff 设置为我的 git diff & 时发现了这个问题。合并工具。
奇怪的是,当我使用 echo opendiff $2 $5 > 时, opendiff-git.sh 创建一个脚本,该脚本不包含参数占位符 $2 $5 我手动添加它们,它开始工作!

这个命令

echo opendiff $2 $5 > opendiff-git.sh

产生了 opendiff-git.sh 文件,其中包含

opendiff

我手动添加了两个参数占位符 $2 $5

opendiff $2 $5

按照 knittl 的建议使 shell 脚本可执行

chmod +x ~/opendiff-git.sh

并且它有效!

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

echo opendiff $2 $5 > opendiff-git.sh

Resulted in opendiff-git.sh file containing

opendiff

I added the two argument placeholders $2 $5 manually

opendiff $2 $5

Made the shell script executable as suggested by knittl

chmod +x ~/opendiff-git.sh

And it works!

三生一梦 2024-11-23 00:21:17

确保您的 opendiff-git.sh 文件已设置可执行位:

chmod +x ~/opendiff-git.sh

make sure your opendiff-git.sh file has its executable bits set:

chmod +x ~/opendiff-git.sh
美煞众生 2024-11-23 00:21:17

您现在可以使用 git config 指定默认工具。要使用 FileMerge,即 opendiff,请运行:

git config --global diff.tool opendiff

如果您查看 ~/.gitconfig 文件,您现在应该看到:

[diff]
    tool = opendiff

它现在应该可以工作了。

You can now specify a default tool using git config. To use FileMerge, i.e. opendiff, run:

git config --global diff.tool opendiff

If you view your ~/.gitconfig file, you should now see:

[diff]
    tool = opendiff

It should now work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文