From: Junio C Hamano Date: Fri, 08 Sep 2017 01:26:46 GMT Subject: Re: git diff doesn't quite work as documented? Message-ID: In-Reply-To: <0696f94d-28c2-1f4b-03ee-16553d97f318@gmail.com> Olaf Klischat writes: > `git diff --help' says: > > git diff [--options] [--] [...] > This form is to view the changes you have in your > working tree relative to the named . That help text is poorly phrased. When "git diff" talks about files in your working tree, it always looks them _through_ the index. As far as the command is concerned, a cruft left in your working tree that is not in the index does *not* exist. So when your index does not have bar.txt, even if you have an untracked bar.txt in your directory, i.e. > oklischat@oklischat:/tmp/gittest$ git status > On branch master > Untracked files: > (use "git add ..." to include in what will be committed) > > bar.txt and you have a commit that _has_ that file, then the command thinks has the path, and your working tree does *not*. IOW, this is... > oklischat@oklischat:/tmp/gittest$ git diff bar-added > diff --git a/bar.txt b/bar.txt > deleted file mode 100644 ... totally expected and intended output. Hope the above explanation clarifies. A documentation update might be helpful to new users. Thanks.