【问题标题】:How do I use Notepad++ Compare as the diff tool in git bash/command line?如何在 git bash/命令行中使用 Notepad++ Compare 作为 diff 工具?
【发布时间】:2016-08-08 07:23:24
【问题描述】:

有什么方法可以改变 gitbash 中默认的 diff 工具吗?

这篇文章似乎暗示这是可能的,但他们没有提供命令行示例。链接:Running NotePad++ from Command line with Compare Plugin showing compare result

【问题讨论】:

    标签: git bash notepad++ diff


    【解决方案1】:

    由于 Notepad++ 的官方差异插件似乎是 uph0/compare,可能的设置可能是:

    $ git config --global --add diff.guitool nppdiff
    $ git config --global --add difftool.nppdiff.path "C:/Program Files/Notepad++/plugins/ComparePlugin/compare.exe"
    $ git config --global --add difftool.nppdiff.trustExitCode false
    

    【讨论】:

    • 好的。我已经执行了上述命令。但是当我使用“diff 1.txt 2.txt”时,它仍然使用默认的 diff。我应该使用不同的命令吗?
    • 你输入的是 diff 还是 git diff?
    • 差异(不与提交比较)
    • @sephiith 你可以用git diff --no-index -- file1 file2(同样,file1file2 可以在任何地方,与任何 git repo 完全无关)与文件(不提交甚至不是 git repo)进行比较)。因为它是一个git diff 命令,它可以使用你为Git 指定的guitooldifftool,即使--no-index 允许git diff 在git repo 之外使用。
    猜你喜欢
    • 1970-01-01
    • 2016-02-20
    • 1970-01-01
    • 2015-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-12
    相关资源
    最近更新 更多