可以在git中进行“混合” word-diff吗?

时间:2019-05-17 16:46:07

标签: git

我真的很想拥有以下内容:

$ git diff
diff --git a/file b/file
index a7d45cf..4155b93 100644
--- a/file
+++ b/file
@@ -1,2 +1,2 @@
-The quick brown fox jumps over the lazy dog.
-The quick brown fox jumps over the lazy dog.
+The quick brown fox jumped over the lazy dog.
+The quick red fox jumps over the hazy frog.


$ git diff --word-diff
diff --git a/file b/file
index a7d45cf..4155b93 100644
--- a/file
+++ b/file
@@ -1,2 +1,2 @@
The quick brown fox [-jumps-]{+jumped+} over the lazy dog.
The quick [-brown-]{+red+} fox jumps over the [-lazy dog.-]{+hazy frog.+}


$ git diff --word-diff --unimplemented-flag
diff --git a/file b/file
index a7d45cf..4155b93 100644
--- a/file
+++ b/file
@@ -1,2 +1,2 @@
The quick brown fox [-jumps-]{+jumped+} over the lazy dog.
-The quick brown fox jumps over the lazy dog.
+The quick red fox jumps over the hazy frog.

在这种情况下,基本思想是能够设置阈值,并且如果一行上出现N个以上的单词差异,则该行将不显示单词差异,而是显示为整行。是否已经存在一些类似的功能?

1 个答案:

答案 0 :(得分:1)

我不知道任何这样的选择,但是可以选择的是diff-highlight,它实际上达到了相同的目标:获得完全的差异(即没有ng-sidebar[ng-reflect-opened=true] + div[_ngcontent-oer-c1] > div[_ngcontent-ocs-c0] a#show-sidebar { left: 300px; } ),但是实际改变的单词从一条线到另一条线。在您的示例中,您将获得:

diff-highlight screenshot

相关问题