【发布时间】:2022-12-10 09:40:29
【问题描述】:
我正在尝试使用 git 的 --ignore-matching-lines,但遇到了一些奇怪的行为。这是普通 git diff 的输出:
$ git diff test.txt
diff --git a/test.txt b/test.txt
index 602c47d1cb..82655814c5 100644
--- a/test.txt
+++ b/test.txt
@@ -1,5 +1,7 @@
-Hello world
+Hello whitespace world
+
Lots of blank lines
Goodbye world
+
但是,如果我跑
$ git diff --ignore-matching-lines='^$' test.txt
我没有输出
为什么这会忽略添加单词whitespace 的更改?
【问题讨论】: