Because git
是为源代码设计的,它的默认值diff
算法将线视为不可分割的最小单位。
我正在尝试编辑一些在第 80 列自动换行的 Markdown 文件。添加句子可能会导致段落的其余部分被标记为已更改。
有没有办法让 Git 使用更适合文本的 diff 算法?我需要一个将单词或句子视为不可分割的单位而不是行的单位?
你可以尝试git diff --word-diff
反而。
$ git diff --word-diff
diff --git a/test.txt b/test.txt
index 54585bb..a8cd97e 100644
--- a/test.txt
+++ b/test.txt
@@ -1,7 +1,7 @@
Because git is designed for source code, its diff algorithms {+are bibbity +}
{+bobbity boo+} treat a line as the minimum indivisible unit. I am trying to edit
some markdown files that are word wrapped at column 80. Adding a sentence can
cause the rest of the paragraph to be marked as changed.
Is there a way to have Git use a diff algorithm more suited to text? One that
treats words or sentences as indivisible units rather then lines?
No newline at end of file
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)