Is there a way to improve git-diff output?

Issue

I have source text:

=head3 POST /throw/rock


Take a rock, throw it. Well done, you.


=head4 Input

=over

=item direction

Compass point or something.

=item speed

In km/h to annoy home counties people who still think in mp/h.

=back


=head4 Output

Which was changed by next text:

=head3 POST /throw/rock


=for doc-viewer input-from POST /drive/tank


Take a rock, throw it. Well done, you.


=head4 Output

The resulting diff is:
enter image description here

Are there options in git that force it to not break patches. I expect result like so:

 =head3 POST /throw/rock
 
 
+=for doc-viewer input-from POST /drive/tank
-Take a rock, throw it. Well done, you.
-
-
-=head4 Input
 
-=over
-
-=item direction
 
-Compass point or something.
-
-=item speed
-
-In km/h to annoy home counties people who still think in mp/h.
-
-=back
+Take a rock, throw it. Well done, you.
 
 
 =head4 Output

Solution

Use --patience or --histogram; they make this particular case even better, because they notice that there is one line that did not change:

@@ -1,22 +1,10 @@
 =head3 POST /throw/rock


+=for doc-viewer input-from POST /drive/tank
+
+
 Take a rock, throw it. Well done, you.


-=head4 Input
-
-=over
-
-=item direction
-
-Compass point or something.
-
-=item speed
-
-In km/h to annoy home counties people who still think in mp/h.
-
-=back
-
-
 =head4 Output

Answered By – j6t

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published