{"thread":{"id":"46753","subject":"git diff --name-status for deleted files","startedAt":"2017-09-14T22:11:10Z","lastAt":"2017-09-15T05:48:10Z","messageCount":4,"participants":["Gene Thomas","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"328081","messageId":"PS1PR0601MB1883177814CA771567A7193B8A6F0@PS1PR0601MB1883.apcprd06.prod.outlook.com","threadId":"46753","inReplyTo":null,"subject":"git diff --name-status for deleted files","fromName":"Gene Thomas","fromEmail":"gene@nlc.co.nz","sentAt":"2017-09-14T22:11:01Z","receivedAt":"2017-09-14T22:11:10Z","isPatch":false,"sender":{"key":"gene@nlc.co.nz","avatar":null},"body":"Hello,\n          \"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.\n\nYours Sincerely,\n\nGene Thomas.\n"},{"id":"328096","messageId":"xmqq1sn8zn1d.fsf@gitster.mtv.corp.google.com","threadId":"46753","inReplyTo":"PS1PR0601MB1883177814CA771567A7193B8A6F0@PS1PR0601MB1883.apcprd06.prod.outlook.com","subject":"Re: git diff --name-status for deleted files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-09-15T02:57:34Z","receivedAt":"2017-09-15T02:57:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gene Thomas <gene@nlc.co.nz> writes:\n\n> Hello,\n>           \"git diff -name-status\" is useful to list the files one\n>           has changed but it does not list file that one has\n>           deleted with \"git rm\". It would be really handy if it\n>           did. I am using git 2.9.3 on Ubuntu Linux 16.10.\n\nWith or without --name-status option, \"git diff\" compares between\nthe contents you have in the index and in your working tree.  After\nyou modify contents of a file, i.e.\n\n\tedit file\n\tgit add file\n\nyou would not see that file edited exactly because the file on the\nfilesystem is identical to what you added to the index with \"git\nadd\".\n\nYour example works exactly the same way.  Instead of modifying the\ncontents of a file, removing the presense of the file and recording\nthat fact to the index (i.e. removing the path from the index, too)\nis done with \"git rm\", so after running\n\n\tgit rm file\n\nyour working tree would lack \"file\" and so would your index.  Hence\nyou wouldn't see \"git diff\" report any difference on \"file\".\n\nPerhaps you wanted \"git diff HEAD\", which is a way to compare\nbetween the contents you have in the tip commit and the paths in\nyour working tree thru the index?\n"},{"id":"328102","messageId":"PS1PR0601MB188364D92388A08D1D62E7078A6C0@PS1PR0601MB1883.apcprd06.prod.outlook.com","threadId":"46753","inReplyTo":"xmqq1sn8zn1d.fsf@gitster.mtv.corp.google.com","subject":"RE: git diff --name-status for deleted files","fromName":"Gene Thomas","fromEmail":"gene@nlc.co.nz","sentAt":"2017-09-15T05:18:43Z","receivedAt":"2017-09-15T05:19:16Z","isPatch":false,"sender":{"key":"gene@nlc.co.nz","avatar":null},"body":"Junio,\n           Thanks for your reply. So git is essentially doing a \"git commit\" when I \"git rm\". \n\nGene.\n\n-----Original Message-----\nFrom: Junio C Hamano [mailto:gitster@pobox.com] \nSent: Friday, 15 September 2017 2:58 PM\nTo: Gene Thomas <gene@nlc.co.nz>\nCc: git@vger.kernel.org\nSubject: Re: git diff --name-status for deleted files\n\nGene Thomas <gene@nlc.co.nz> writes:\n\n> Hello,\n>           \"git diff -name-status\" is useful to list the files one\n>           has changed but it does not list file that one has\n>           deleted with \"git rm\". It would be really handy if it\n>           did. I am using git 2.9.3 on Ubuntu Linux 16.10.\n\nWith 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.\n\n\tedit file\n\tgit add file\n\nyou 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\".\n\nYour 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\n\n\tgit rm file\n\nyour working tree would lack \"file\" and so would your index.  Hence you wouldn't see \"git diff\" report any difference on \"file\".\n\nPerhaps 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?\n"},{"id":"328103","messageId":"xmqqd16sy0ky.fsf@gitster.mtv.corp.google.com","threadId":"46753","inReplyTo":"PS1PR0601MB188364D92388A08D1D62E7078A6C0@PS1PR0601MB1883.apcprd06.prod.outlook.com","subject":"Re: git diff --name-status for deleted files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-09-15T05:47:57Z","receivedAt":"2017-09-15T05:48:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gene Thomas <gene@nlc.co.nz> writes:\n\n> Junio,\n>            Thanks for your reply. So git is essentially doing a\n>            \"git commit\" when I \"git rm\".\n\nNo. You'd probably need to read a bit more on Git; unlike other\nsystems like CVS and SVN, where you only have two states\n(i.e. committed contents vs files on the filesystem), we have three\nstates (i.e. the index in addition to the above two).\n\n\"git add file\" and \"git rm file\" make the index match what's on the\nfilesystem wrt \"file\".  They never touch committed contents, which\n\"git commit\" command is about.\n\n"}]}