{"thread":{"id":"6507","subject":"git-rm'ing all dead files","startedAt":"2007-01-24T16:17:07Z","lastAt":"2007-01-24T17:02:07Z","messageCount":5,"participants":["Pazu","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"32529","messageId":"loom.20070124T171435-429@post.gmane.org","threadId":"6507","inReplyTo":null,"subject":"git-rm'ing all dead files","fromName":"Pazu","fromEmail":"pazu@pazu.com.br","sentAt":"2007-01-24T16:17:07Z","receivedAt":"2007-01-24T16:17:07Z","isPatch":false,"sender":{"key":"pazu@pazu.com.br","avatar":null},"body":"I couldn't find an easy way to remove all \"dead\" files from the index, i.e.,\ncall git-rm on all files that are missing from the working copy.\n\nHere's the scenario: I moved/added/removed a lot of files using a GUI tool; now\nI need to reflect those changes in git. Using git-commit -a isn't the best\nchoice because there are local modifications I don't want to commit. I can use\n\"git add .\" to automatically stage all new files, but how to the same for\nremoved files?\n\n-- Pazu\n"},{"id":"32531","messageId":"Pine.LNX.4.63.0701241723560.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6507","inReplyTo":"loom.20070124T171435-429@post.gmane.org","subject":"Re: git-rm'ing all dead files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-24T16:25:50Z","receivedAt":"2007-01-24T16:25:50Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 24 Jan 2007, Pazu wrote:\n\n> I couldn't find an easy way to remove all \"dead\" files from the index, \n> i.e., call git-rm on all files that are missing from the working copy.\n\nHow about\n\n\tgit ls-files -z --deleted | git update-index -z --remove --stdin\n\n?\n\nCiao,\nDscho\n"},{"id":"32535","messageId":"9e7ab7380701240851u1249b46ch36450fcf91bf7986@mail.gmail.com","threadId":"6507","inReplyTo":"Pine.LNX.4.63.0701241723560.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git-rm'ing all dead files","fromName":"Pazu","fromEmail":"pazu@pazu.com.br","sentAt":"2007-01-24T16:51:24Z","receivedAt":"2007-01-24T16:51:24Z","isPatch":false,"sender":{"key":"pazu@pazu.com.br","avatar":null},"body":"2007/1/24, Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n\n> How about\n>\n>         git ls-files -z --deleted | git update-index -z --remove --stdin\n\nAha. I was trying\n\n    git-ls-files -d | xargs git rm --cached\n\nbut most removed files contains spaces in their names, and that\nscrewed git-rm up. I've even noticed the -z option on git-ls-files,\nbut couldn't find one on git-rm, and I completely forgot about\ngit-update-index.\n\nThanks, Johannes. This should do the trick.\n\n-- Pazu\n"},{"id":"32537","messageId":"Pine.LNX.4.63.0701241756300.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6507","inReplyTo":"9e7ab7380701240851u1249b46ch36450fcf91bf7986@mail.gmail.com","subject":"Re: git-rm'ing all dead files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-24T16:57:32Z","receivedAt":"2007-01-24T16:57:32Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 24 Jan 2007, Pazu wrote:\n\n> 2007/1/24, Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> \n> > How about\n> > \n> >         git ls-files -z --deleted | git update-index -z --remove --stdin\n> \n> Aha. I was trying\n> \n>    git-ls-files -d | xargs git rm --cached\n> \n> but most removed files contains spaces in their names, and that\n> screwed git-rm up. I've even noticed the -z option on git-ls-files,\n> but couldn't find one on git-rm, and I completely forgot about\n> git-update-index.\n\nYou _can_ use\n\n\tgit ls-files -z -d | xargs -0 git rm --cached\n\nSo, you did not find that option with git-rm, because it is an option to \nxargs...\n\nCiao,\nDscho\n"},{"id":"32538","messageId":"9e7ab7380701240902i4168cc40x1629e76bdf75dcfb@mail.gmail.com","threadId":"6507","inReplyTo":"Pine.LNX.4.63.0701241756300.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git-rm'ing all dead files","fromName":"Pazu","fromEmail":"pazu@pazu.com.br","sentAt":"2007-01-24T17:02:07Z","receivedAt":"2007-01-24T17:02:07Z","isPatch":false,"sender":{"key":"pazu@pazu.com.br","avatar":null},"body":"2007/1/24, Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> You _can_ use\n>\n>         git ls-files -z -d | xargs -0 git rm --cached\n>\n> So, you did not find that option with git-rm, because it is an option to\n> xargs...\n\nI remember trying that, but git-rm was still confused about spaces in\nfilenames. I'll try it again the next time I'm in a situation like\nthat.\n\n-- Pazu\n"}]}