1

I am trying to find out what does the "-" mean in the git diff I get. It is not a new line because when I add a line I get a "+".

diff --git a/webapp/pom.xml b/webapp/pom.xml
index 73486d22a..a58a214c3 100755
--- a/webapp/pom.xml
+++ b/webapp/pom.xml
@@ -180,7 +180,6 @@
             <version>1.5.8</version>
         </dependency>
         -->
-
     </dependencies>

     <profiles>
Ana Sustic
  • 425
  • 2
  • 17
  • 5
    That means that the empty line has been removed. You can remove the modification by checking out the file : `git checkout pom.xml`. – Gangai Johann Jan 08 '20 at 09:06
  • 1
    Does this answer your question? [How to read the output from git diff?](https://stackoverflow.com/questions/2529441/how-to-read-the-output-from-git-diff) – phd Jan 08 '20 at 14:38
  • 1
    https://stackoverflow.com/search?q=%5Bgit-diff%5D+output+format – phd Jan 08 '20 at 14:39

3 Answers3

2

It means the line was removed in the newer file.

Excerpt from the git diff documentation:

    A - character in the column N means that the line appears in fileN but it does 
    not appear in the result. A + character in the column N means that the line 
    appears in the result, and fileN does not have that line (in other words, the
    line was added, from the point of view of that parent).
mrzo
  • 2,002
  • 1
  • 14
  • 26
1

Here is details about the git diff

https://git-scm.com/docs/git-diff

Specified the character used to indicate new, old or context lines in the generated patch. Normally they are +, - and ' ' respectively.

Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
0

From the git diff manual

https://git-scm.com/docs/git-diff:

A "combined diff" format looks like this:

diff --combined describe.c
index fabadb8,cc95eb0..4866510
--- a/describe.c
+++ b/describe.c
@@@ -98,20 -98,12 +98,20 @@@
    return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
  }

- static void describe(char *arg)
 -static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
  {
 +  unsigned char sha1[20];
 +  struct commit *cmit;
    struct commit_list *list;
    static int initialized = 0;
    struct commit_name *n;

 +  if (get_sha1(arg, sha1) < 0)
 +      usage(describe_usage);
 +  cmit = lookup_commit_reference(sha1);
 +  if (!cmit)
 +      usage(describe_usage);
 +
    if (!initialized) {
        initialized = 1;
        for_each_ref(get_name);

It is followed by two-line from-file/to-file header

--- a/file
+++ b/file

Similar to two-line header for traditional unified diff format, /dev/null is used to signal created or deleted files.

R Harrington
  • 253
  • 2
  • 10
  • The example in the question is a regular diff, not a combined diff. (It probably would be useful if the Git documentation described a regular diff before diving into the combined diff format.) – torek Jan 08 '20 at 09:19