设置记事本++与git中的diff工具比较?
有没有一种简单的方法可以将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,Notepad++ 不允许为其插件提供自定义命令行选项,因此这样做会有点棘手。您需要为其创建一个包装脚本或直接调用可执行文件。以我的愚见,鉴于存在一些非常好的 diff 工具选项,因此不值得。
无论如何,
git difftool
允许您指定您希望 git 用于 diff 的具体内容。您可以将其添加到您的.gitconfig
文件中:如果您想了解更多相关信息,请参阅以下手册页链接: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: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
我刚刚发布了类似问题的解决方案 在这里。顺便说一句,选择 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.
由于 ComparePlus 已经推出,实际上可以轻松地将其设置为 git difftool。
ComparePlus 是 Compare 的后继者,我使用从插件管理安装的 1.1 版本来设置它。
在 .gitconfig 文件中,添加以下行(调整 notepad++.exe 的路径,如果您在其他地方安装了它):
-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):
-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.