{"thread":{"id":"42785","subject":"Fwd: git rm","startedAt":"2016-07-05T21:55:49Z","lastAt":"2016-07-10T12:45:51Z","messageCount":7,"participants":["Peter","Andreas Schwab","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"290865","messageId":"CAK8tuqhMiHqPoK4gk7onT+VXsLJE5ogcpu7dc=_8am+ifL=5yQ@mail.gmail.com","threadId":"42785","inReplyTo":"CAK8tuqiZjfrvHCoxkFUqoDx0+9=FUxfE93aMhUkYYZAAWm-u_w@mail.gmail.com","subject":"Fwd: git rm","fromName":"Peter","fromEmail":"peter.mx@gmail.com","sentAt":"2016-07-05T21:55:24Z","receivedAt":"2016-07-05T21:55:49Z","isPatch":false,"sender":{"key":"peter.mx@gmail.com","avatar":null},"body":"Greetings to the community of this wonderful piece of software!\n\n\nI am a lightweigt git user so by all means not a reference, but I was\nwondering why exactly does \"git rm\" also delete the file (remove it\nfrom the working tree). I see it as an unintended behaviour as git is\nwritten in a way that it preserves the most data. Usually git commands\nare very basic and the usual workflow requires more consecutive\ncommands, it even has its own shell. But \"git rm\" does everything in\none step even though there are lots of scenarios where the file should\nbe kept. I am aware of the \"git rm --cache\" command, but from my\nperspective \"git rm --delete\" is the one that is needed...\n\nGUI users and some CLI users (by using trash-put or similar tool) also\nuse trash before removing the file completely. Does \"git rm\" support\nfreedesktop.org trash specification?\n\n\nThank you for your answers in advance,\nPeter\n"},{"id":"290889","messageId":"87a8hubtw4.fsf@linux-m68k.org","threadId":"42785","inReplyTo":"CAK8tuqhMiHqPoK4gk7onT+VXsLJE5ogcpu7dc=_8am+ifL=5yQ@mail.gmail.com","subject":"Re: Fwd: git rm","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2016-07-06T16:42:19Z","receivedAt":"2016-07-06T16:42:32Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Peter <peter.mx@gmail.com> writes:\n\n> I am a lightweigt git user so by all means not a reference, but I was\n> wondering why exactly does \"git rm\" also delete the file (remove it\n> from the working tree). I see it as an unintended behaviour as git is\n> written in a way that it preserves the most data.\n\nThe data is still preserved.  You can restore it with \"git checkout HEAD\n<file>\".\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"290926","messageId":"20160707033538.GA7595@sigill.intra.peff.net","threadId":"42785","inReplyTo":"87a8hubtw4.fsf@linux-m68k.org","subject":"Re: Fwd: git rm","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-07T03:35:38Z","receivedAt":"2016-07-07T03:35:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 06, 2016 at 06:42:19PM +0200, Andreas Schwab wrote:\n\n> Peter <peter.mx@gmail.com> writes:\n> \n> > I am a lightweigt git user so by all means not a reference, but I was\n> > wondering why exactly does \"git rm\" also delete the file (remove it\n> > from the working tree). I see it as an unintended behaviour as git is\n> > written in a way that it preserves the most data.\n> \n> The data is still preserved.  You can restore it with \"git checkout HEAD\n> <file>\".\n\nAssuming the file is present in HEAD, of course. But if it is not, then\ngit should (and does) complain and ask for \"-f\".\n\n-Peff\n"},{"id":"291125","messageId":"CAK8tuqiCMUjoS_xXKSJ4qiGK8ioAjfGsQ3_WO0OQj5-5-i7rOw@mail.gmail.com","threadId":"42785","inReplyTo":"20160707033538.GA7595@sigill.intra.peff.net","subject":"Re: Fwd: git rm","fromName":"Peter","fromEmail":"peter.mx@gmail.com","sentAt":"2016-07-10T08:38:32Z","receivedAt":"2016-07-10T08:38:59Z","isPatch":false,"sender":{"key":"peter.mx@gmail.com","avatar":null},"body":"So if I do:\n\ntouch abc\ngit add abc\n\n\nAnd after that I do:\n\ngit rm abc\n\n\nCan you agree that there is an asymmetry of two commands vs. one? Git\nadd only touches the files in .git/ and git rm ALSO affects the\nworking tree...\n\nIs \"git rm\" or \"git rm --cache\" used more often in practice?\n\n\nPeter\n\nOn 7 July 2016 at 05:35, Jeff King <peff@peff.net> wrote:\n> On Wed, Jul 06, 2016 at 06:42:19PM +0200, Andreas Schwab wrote:\n>\n>> Peter <peter.mx@gmail.com> writes:\n>>\n>> > I am a lightweigt git user so by all means not a reference, but I was\n>> > wondering why exactly does \"git rm\" also delete the file (remove it\n>> > from the working tree). I see it as an unintended behaviour as git is\n>> > written in a way that it preserves the most data.\n>>\n>> The data is still preserved.  You can restore it with \"git checkout HEAD\n>> <file>\".\n>\n> Assuming the file is present in HEAD, of course. But if it is not, then\n> git should (and does) complain and ask for \"-f\".\n>\n> -Peff\n"},{"id":"291130","messageId":"87bn254v7b.fsf@linux-m68k.org","threadId":"42785","inReplyTo":"CAK8tuqiCMUjoS_xXKSJ4qiGK8ioAjfGsQ3_WO0OQj5-5-i7rOw@mail.gmail.com","subject":"Re: Fwd: git rm","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2016-07-10T10:57:12Z","receivedAt":"2016-07-10T10:57:20Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Peter <peter.mx@gmail.com> writes:\n\n> So if I do:\n>\n> touch abc\n> git add abc\n>\n>\n> And after that I do:\n>\n> git rm abc\nerror: the following file has changes staged in the index:\n    abc\n(use --cached to keep the file, or -f to force removal)\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"291134","messageId":"CAK8tuqj8_Xgp1f+SPArmMHQs_+u6gOMnt958GXXRnTp4MAuB3g@mail.gmail.com","threadId":"42785","inReplyTo":"87bn254v7b.fsf@linux-m68k.org","subject":"Re: Fwd: git rm","fromName":"Peter","fromEmail":"peter.mx@gmail.com","sentAt":"2016-07-10T12:23:54Z","receivedAt":"2016-07-10T12:24:18Z","isPatch":false,"sender":{"key":"peter.mx@gmail.com","avatar":null},"body":"Ah, ok, I see now. But are there any other situations where the \"-f\"\nswitch is not needed?\n\nPeter\n\nOn 10 July 2016 at 12:57, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Peter <peter.mx@gmail.com> writes:\n>\n>> So if I do:\n>>\n>> touch abc\n>> git add abc\n>>\n>>\n>> And after that I do:\n>>\n>> git rm abc\n> error: the following file has changes staged in the index:\n>     abc\n> (use --cached to keep the file, or -f to force removal)\n>\n> Andreas.\n>\n> --\n> Andreas Schwab, schwab@linux-m68k.org\n> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n> \"And now for something completely different.\"\n"},{"id":"291135","messageId":"874m7x4q6g.fsf@linux-m68k.org","threadId":"42785","inReplyTo":"CAK8tuqj8_Xgp1f+SPArmMHQs_+u6gOMnt958GXXRnTp4MAuB3g@mail.gmail.com","subject":"Re: Fwd: git rm","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2016-07-10T12:45:43Z","receivedAt":"2016-07-10T12:45:51Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Peter <peter.mx@gmail.com> writes:\n\n> Ah, ok, I see now. But are there any other situations where the \"-f\"\n> switch is not needed?\n\nWhen the file is unmodified and matches the index.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}