Что означает знак Git diff "-" - PullRequest
1 голос
/ 08 января 2020

Я пытаюсь выяснить, что означает "-" в разнице git, которую я получаю. Это не новая строка, потому что когда я добавляю строку, я получаю «+».

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>

Ответы [ 3 ]

2 голосов
/ 08 января 2020

Это означает, что строка была удалена в новом файле.

Выдержка из git документации diff :

    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).
1 голос
/ 08 января 2020

Вот подробности о git diff

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

Указанный символ, используемый для обозначения новых, старых или контекстных строк в сгенерированном патче. Обычно это +, - и '' соответственно.

0 голосов
/ 08 января 2020

Из руководства git diff

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

Формат "комбинированного различий" выглядит следующим образом:

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);

За ним следует двухстрочный заголовок из файла / в файл

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

Аналогично двухстрочному заголовку для традиционного унифицированного формата diff , / dev / null используется для обозначения созданных или удаленных файлов.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...