RE: git diff --name-status for deleted files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio,
           Thanks for your reply. So git is essentially doing a "git commit" when I "git rm". 

Gene.

-----Original Message-----
From: Junio C Hamano [mailto:gitster@xxxxxxxxx] 
Sent: Friday, 15 September 2017 2:58 PM
To: Gene Thomas <gene@xxxxxxxxx>
Cc: git@xxxxxxxxxxxxxxx
Subject: Re: git diff --name-status for deleted files

Gene Thomas <gene@xxxxxxxxx> 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?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux