When I use svn diff
or git diff
it shows lines like:
@@ -1,5 +1,9 @@
What do they mean?
Simple example analysis @@ -1,6 +1,4 @@ means: -1,6 means that this piece of the first file starts at line 1 and shows a total of 6 lines. Therefore it shows lines 1 to 6. 1 2 3 4 5 6. - means "old", as we usually invoke it as diff -u old new .
The 'before' value is the sum of the 3 lead context lines, the number of - lines, and the 3 trailing context lines, while the 'after' values is the sum of 3 lead context lines, the number of + lines and the 3 trailing lines.
Those are called (c)hunk headers and contain the range information.
They are surrounded by double at signs @@
. They are of the format:
@@ -l,s +l,s @@
where l
is the starting line number and s
is the number of lines the change (c)hunk applies to for each respective file. The -
indicates the original file and the +
indicates the new (modified) file. Note that it not only shows affected lines, but also context lines.
The -1,5
is in the original file (indicated by the -
). It shows that that first line is the start and 5 affected / context lines
The +1,9
is in the new (modified) file (indicated by the +
) and again first line is the start and 9 affected / context lines.
More details here: http://en.wikipedia.org/wiki/Diff#Unified_format
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With