git: diff header – hunk differences (or what does something like “@@ -395,3 +395,2 @@ body {” mean)

On doing a git diff you’ll get a diff header which looks like this:

index 9d6fe59..e072dd6 100644

This means we have a file (hence the file mode) and not a symlink.

 

Then we have various hunks of differences starting with lines like:

@@ -395,3 +395,2 @@ body {

Here the format is: @@ from-file-range to-file-range @@ [header]. The from-file-range is in the form -<start line>,<number of lines>, and to-file-range is +<start line>,<number of lines>.

i.e.

-395,3: from file – start line 395, 3 lines

+395,2 to file – start line 395, 2 lines

More info here:
http://stackoverflow.com/questions/2529441/how-to-work-with-diff-representation-in-git

Leave a Reply

Your email address will not be published. Required fields are marked *