What does a Git diff "-" sign means

git diff side-by-side
git diff example
git diff between commits
git diff between branches
exit git diff
git diff between two commits
git diff two files
git diff (--options)

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>

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

git-diff Documentation, Diff command is used in git to track the difference between the changes made on a file. Since Git is a version control system, tracking changes are� Diff command is used in git to track the difference between the changes made on a file. Since Git is a version control system , tracking changes are something very vital to it. Diff command takes two inputs and reflects the differences between them.

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.

Git - git-diff Documentation, In most cases, A and B will be the same file, but in different versions. Although not used very often, a diff could also compare two completely unrelated files with� $ git diff --diff-filter=MRC (1) $ git diff --name-status (2) $ git diff arch/i386 include/asm-i386 (3) Show only modification, rename, and copy, but not addition or deletion. Show only names and the nature of change, but not actual diff output.

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.

What is Git Diff Command in Git and How does it work?, versions of files. Git provides a command diff to let you to compare different versions of your files. So, a git status will give an output like this:. git diff –cached: Differences between the Index and the most recent commit. The version of README in the index is the same as the one most recent commit, so a git diff –cached shows no difference: $ git diff --cached. git diff HEAD: Show differences between the Working Directory and the most recent commit

Inspecting Changes with Diffs, It's an "imaginary diff option", used to indicate to the reader that it's not just the output of running the diff command. For example, in git's own git� In any case, this commit message makes it clear that diff --git is an "imaginary diff option". This email message, cited by nos in a comment, appears to be part of the discussion that led to this. UPDATE: I speculated above that git diff massages the output of diff, adding this information. I just tried running git diff under strace.

Git Tutorial: Comparing Files With diff, The git diff command allows us to track the changes that are staged but not committed. We can track the changes in the staging area. To check the already staged� git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on.. Stashing is handy if you need to quickly switch context and work on something else, but you're mid-way through a code change and aren't quite ready to

What does the "diff --git" output in "git diff" refer to?, This section will show you the different ways you can use diff to answer common quesions you might have about your repository. changes that have not been� git diff <branch> -- <path> as already mentioned above prints a diff of the given path (file or directory) between the current working directory and the specified branch. git checkout <branch> -- <path> checks out files from a different branch into the working directory, so you can pick changes from another branch.

Comments
  • That means that the empty line has been removed. You can remove the modification by checking out the file : git checkout pom.xml.
  • Does this answer your question? How to read the output from git diff?
  • stackoverflow.com/search?q=%5Bgit-diff%5D+output+format
  • 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.)