我想让diff在某些特定类型的文档中更好地工作。例如,在使用LaTeX时,我可能有一个非常长的段落,但如果只更改了一句话,我不想看到整个段落。特别是当我运行某种版本控制并且共同作者与我编辑了相同的段落(但不是相同的句子)时。我不希望这会显示为冲突。那是一个次要问题。主要问题是我是否可以使用diff逐句查看。谢谢。
编辑
wdiff几乎完美。但是是否有合并等效物,如diff和diff3?
编辑
wdiff几乎完美。但是是否有合并等效物,如diff和diff3?
wdiff
可以让你获得逐字逐词的差异而不是逐行差异。 我不知道有任何句子逐句差异程序。
在进行文件差异比较之前,请对其进行预处理。编写一个脚本,每行写一句话,任何逐行差异程序都可以工作。
我已经在C令牌级别上完成了这项工作,以便比较C代码,以确保我的CVS合并是正确的。
This is a common part of the sentence, and previously we had this and the rest is common again
到
This is a common part of the sentence, but then we changed this part and the rest is common again
git diff --word-diff=porcelain
将会给出: This is a common part of the sentence,
-and previously we had this
+but then we changed this part
and the rest is common again
-
行将被标记为红色,而+
行将被标记为绿色)