From: Junio C Hamano <gitster@pobox.com>
To: Gene Thomas <gene@nlc.co.nz>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git diff --name-status for deleted files
Date: Fri, 15 Sep 2017 11:57:34 +0900 [thread overview]
Message-ID: <xmqq1sn8zn1d.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <PS1PR0601MB1883177814CA771567A7193B8A6F0@PS1PR0601MB1883.apcprd06.prod.outlook.com> (Gene Thomas's message of "Thu, 14 Sep 2017 22:11:01 +0000")
Gene Thomas <gene@nlc.co.nz> writes:
> Hello,
> "git diff -name-status" is useful to list the files one
> has changed but it does not list file that one has
> deleted with "git rm". It would be really handy if it
> did. I am using git 2.9.3 on Ubuntu Linux 16.10.
With or without --name-status option, "git diff" compares between
the contents you have in the index and in your working tree. After
you modify contents of a file, i.e.
edit file
git add file
you would not see that file edited exactly because the file on the
filesystem is identical to what you added to the index with "git
add".
Your example works exactly the same way. Instead of modifying the
contents of a file, removing the presense of the file and recording
that fact to the index (i.e. removing the path from the index, too)
is done with "git rm", so after running
git rm file
your working tree would lack "file" and so would your index. Hence
you wouldn't see "git diff" report any difference on "file".
Perhaps you wanted "git diff HEAD", which is a way to compare
between the contents you have in the tip commit and the paths in
your working tree thru the index?
next prev parent reply other threads:[~2017-09-15 2:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 22:11 git diff --name-status for deleted files Gene Thomas
2017-09-15 2:57 ` Junio C Hamano [this message]
2017-09-15 5:18 ` Gene Thomas
2017-09-15 5:47 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1sn8zn1d.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=gene@nlc.co.nz \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox