Search code examples
gitsvndiff

What does the “@@…@@” meta line with at signs in svn diff or git diff mean?


When I use svn diff or git diff it shows lines like:

@@ -1,5 +1,9 @@

What do they mean?


Solution

  • 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