gpt4 book ai didi

word-diff - 命令行递归基于单词的差异?

转载 作者:行者123 更新时间:2023-12-03 23:23:51 28 4
gpt4 key购买 nike

是否有命令行程序提供基于单词的递归差异(在 2 个目录上)?
diff -u是递归的,但它不会逐字比较。 wdiffdwdiff做基于单词的差异,但没有递归差异的内置选项。

我想将结果通过管道传送到 colordiff所以一个生成输出 colordiff 的程序理解会特别有用。有什么建议?谢谢!

抄送

最佳答案

Git 可以做到并输出颜色:

以下通常有效:

git diff --color-words path1 path2

但总的来说你可能需要做
git diff --no-index --color-words path1 path2

这两个文件甚至都不需要在 git 存储库中!
--no-index如果您和路径在 git 工作树中,则需要。如果您或其中一个文件位于 git 工作树之外,则可以省略它。

联机帮助页: https://git-scm.com/docs/git-diff/1.8.5 (然后...)

git diff --no-index [--options] [--] […​]

This form is to compare the given two paths on the filesystem. You can omit the --no-index option when running the command in a working tree controlled by Git and at least one of the paths points outside the working tree, or when running the command outside a working tree controlled by Git.

关于word-diff - 命令行递归基于单词的差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4981715/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com