I wonder if it\'s possible to add a certain amount of unparsed content to a diff file (unified) that is ignored as a comment.
One good use of this would be having g
The unified diff starts with two line header:
--- from-file from-file-modification-time
+++ to-file to-file-modification-time
Anything before this header is ignored, so you can add any comment here, for example:
This may be some useful description of this patch that
will be ignored by the diff/patch utility.
--- a/foo 2002-02-21 23:30:39.942229878 -0800
+++ b/foo 2002-02-21 23:30:50.442260588 -0800
@@ -1,7 +1,6 @@
-The Way that can be told of is not the eternal Way;
-The name that can be named is not the eternal name.
The Nameless is the origin of Heaven and Earth;
-The Named is the mother of all things.
+The named is the mother of all things.
+
Therefore let there always be non-being,
so we may see their subtlety,
And let there always be being,
Git itself uses this space before header for some metadata, for example:
diff --git a/foo b/foo
index 59a4d1f..e48dfe7 100644
--- a/foo
+++ b/foo
You can use #
instead of -
or +
in the diff file for inline comments (recognizable by GNU patch), or add a comment at the begining mentioned by @JakubJirutka
This may be some useful description of this patch that
will be ignored by the diff/patch utility.
--- a/foo 2002-02-21 23:30:39.942229878 -0800
+++ b/foo 2002-02-21 23:30:50.442260588 -0800
@@ -1,7 +1,6 @@
# comments on the deletion of the two lines
-The Way that can be told of is not the eternal Way;
-The name that can be named is not the eternal name.
The Nameless is the origin of Heaven and Earth;
-The Named is the mother of all things.
+The named is the mother of all things.
+
Therefore let there always be non-being,
so we may see their subtlety,
And let there always be being,
Anything after @@ on the same line is also ignored.
--- a/foo 2002-02-21 23:30:39.942229878 -0800
+++ b/foo 2002-02-21 23:30:50.442260588 -0800
@@ -1,7 +1,6 @@ THIS IS A COMMENT THAT WILL BE IGNORED
-The Way that can be told of is not the eternal Way;
-The name that can be named is not the eternal name.
The Nameless is the origin of Heaven and Earth;
-The Named is the mother of all things.
+The named is the mother of all things.
+
Therefore let there always be non-being,
so we may see their subtlety,
And let there always be being,