What does “@@ -1 +1 @@” mean in Git’s diff output?


I’ve been collecting data from the information returned from

and I ran into @@ -1 +1 @@

I can’t figure out what that’s telling me. I’ve searched a bit on Google but to no avail.


It’s a unified diff hunk identifier. This is documented by GNU Diffutils.

The unified output format starts with a two-line header, which looks like this:

The time stamp looks like 2002-02-21 23:30:39.942229878 -0800 to indicate the date, time with fractional seconds, and time zone. The fractional seconds are omitted on hosts that do not support fractional time stamps.

You can change the header’s content with the --label=label option; see See Alternate Names.

Next come one or more hunks of differences; each hunk shows one area where the files differ. Unified format hunks look like this:

If a hunk contains just one line, only its start line number appears. Otherwise its line numbers look like start,count. An empty hunk is considered to start at the line that follows the hunk.

If a hunk and its context contain two or more lines, its line numbers look like start,count. Otherwise only its end line number appears. An empty hunk is considered to end at the line that precedes the hunk.

The lines common to both files begin with a space character. The lines that actually differ between the two files have one of the following indicator characters in the left print column:

  • +
    A line was added here to the first file.

  • A line was removed here from the first file.

Leave a Reply