设置记事本++与git中的diff工具比较?

发布于 2024-11-27 22:00:54 字数 94 浏览 1 评论 0原文

有没有一种简单的方法可以将 Notepad++ 的 Compare 插件设置为 Windows 上 Git 的 diff 工具?我不确定是否可以从命令行调用它,所以也许不能。

Is there an easy way to setup Notepad++'s Compare plugin as the diff tool for Git on Windows? I'm not sure whether it can be called from the command line so maybe not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

墨落画卷 2024-12-04 22:00:54

据我所知,Notepad++ 不允许为其插件提供自定义命令行选项,因此这样做会有点棘手。您需要为其创建一个包装脚本或直接调用可执行文件。以我的愚见,鉴于存在一些非常好的 diff 工具选项,因此不值得。

无论如何,git difftool 允许您指定您希望 git 用于 diff 的具体内容。您可以将其添加到您的 .gitconfig 文件中:

[diff]
tool = araxis // enter your tool of choice here, Araxis is just an example

如果您想了解更多相关信息,请参阅以下手册页链接:http://www.kernel.org/pub/software/scm/git/docs/git-difftool.html< /a>

As far as I know, Notepad++ doesn't allow custom command-line options for its plugins, so it would be a tad tricky to do so. You would need to create a wrapper script for it or call the executable directly. In my humble opinion, not worth it given that there are some very nice options for diff tools out there.

In any case, git difftool allows you to specify what exactly you'd like git to use for diff. You'll add this to your .gitconfig file:

[diff]
tool = araxis // enter your tool of choice here, Araxis is just an example

If you'd like to read more about it, here's a link to the man page: http://www.kernel.org/pub/software/scm/git/docs/git-difftool.html

自我难过 2024-12-04 22:00:54

我刚刚发布了类似问题的解决方案 在这里。顺便说一句,选择 N++ 作为 diff 查看器的要点之一是,如果您无论如何都在 N++ 中处理 Git 管理的代码,那么您始终可以直接“与 GIT 基础进行比较”(v1.5.6.3 !)。另一个原因当然是在“真正的”编辑器中查看差异,并使用语法突出显示和所有其他众所周知的好东西。

I've just posted a solution to a similar question over here. Btw, one of the main points in preferring N++ as a diff viewer is, for instance, that if you're anyway handling Git-managed code in N++, then you can always directly "Compare against GIT base" (v1.5.6.3!). Another reason is of course looking at a diff in a "real" editor with syntax highlighting and all the other well known goodies at hand.

毁我热情 2024-12-04 22:00:54

由于 ComparePlus 已经推出,实际上可以轻松地将其设置为 git difftool。

ComparePlus 是 Compare 的后继者,我使用从插件管理安装的 1.1 版本来设置它。

在 .gitconfig 文件中,添加以下行(调整 notepad++.exe 的路径,如果您在其他地方安装了它):

[diff]
tool = npp_compareplus

[difftool]
prompt = false

[difftool "npp_compareplus"]
cmd = \"C:\\Program Files\\Notepad++\\notepad++.exe\" -multiInst -nosession -pluginMessage=compare \"$REMOTE\" \"$LOCAL\"

-multiInst 将在新窗口中启动 diff,-nosession< /code> 将打开新窗口,而不会打开旧/其他会话的任何其他文件,并且 -pluginMessage=compare 告诉 npp 使用 ComparePlus 并让它知道本地/远程文件的参数。

Since ComparePlus is out, it is actually easily possible to set it up as the git difftool.

ComparePlus is the successor of Compare, I set it up with version 1.1 installed from the Plugins Admin.

In your .gitconfig file, add the following lines (adjust the path to notepad++.exe, if you installed it elsewhere):

[diff]
tool = npp_compareplus

[difftool]
prompt = false

[difftool "npp_compareplus"]
cmd = \"C:\\Program Files\\Notepad++\\notepad++.exe\" -multiInst -nosession -pluginMessage=compare \"$REMOTE\" \"$LOCAL\"

-multiInst will start the diff in a new window, -nosession will open the new window without any other files open of your old/other session and -pluginMessage=compare tells npp to use the ComparePlus and let's it know of the arguments for the local/remote file.

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