Is it possible to tell git diff
to assume lines staring with some pattern as unchanged?
For example, consider the following:
$ git diff -U0
diff --git a/file_a.txt b/file_a.txt
index 26ed843..4071ff8 100644
--- a/file_a.txt
+++ b/file_a.txt
@@ -24 +24 @@
- * unimportant foo
+ * unimportant bar
diff --git a/file_b.txt b/file_b.txt
index c6d051e..4b3cf22 100644
--- a/file_b.txt
+++ b/file_b.txt
@@ -24 +24 @@
- * unimportant foo
+ * unimportant bar
@@ -48,0 +49 @@
+ this is important
@@ -56,0 +58 @@
+ this is also important
Lines starting with an asterisk (regex pattern "^[[:space:]]*\*.*"
) are not important and I would like to filter files that contain changes in such lines only from the output of git diff
. In the example above, the output should report file_b.txt
changes only. Is it possible?