{"thread":{"id":"4934","subject":"Easy way to empty working tree?","startedAt":"2006-07-21T01:28:46Z","lastAt":"2006-07-21T07:08:40Z","messageCount":3,"participants":["Robin Luckey","Linus Torvalds","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"23964","messageId":"761519800607201828m19684b2jc267411ef3b8b9e2@mail.gmail.com","threadId":"4934","inReplyTo":null,"subject":"Easy way to empty working tree?","fromName":"Robin Luckey","fromEmail":"robinluckey@gmail.com","sentAt":"2006-07-21T01:28:46Z","receivedAt":"2006-07-21T01:28:46Z","isPatch":false,"sender":{"key":"robinluckey@gmail.com","avatar":"https://gravatar.com/avatar/138b4809edf4be33c28d6379cc606d88fe784b65f75c77cf9df910da190e04ff?d=mp&s=160"},"body":"I have some very large git repositories that serve mainly as archives,\nand it would be nice to clear out the working directories for the\nrepositories I am not currently working with. I'm not trying to delete\nthe files from the repository, I just want free up space in idle\nrepositories.\n\nAfter mothballing the repository with git-repack -a -d and git clean\n-d -x, is there a convenient one-liner to empty the files out the\nworking directory?\n\nThanks,\nRobin\n"},{"id":"23965","messageId":"Pine.LNX.4.64.0607201944460.29649@g5.osdl.org","threadId":"4934","inReplyTo":"761519800607201828m19684b2jc267411ef3b8b9e2@mail.gmail.com","subject":"Re: Easy way to empty working tree?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-07-21T02:48:53Z","receivedAt":"2006-07-21T02:48:53Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 20 Jul 2006, Robin Luckey wrote:\n>\n> I have some very large git repositories that serve mainly as archives,\n> and it would be nice to clear out the working directories for the\n> repositories I am not currently working with. I'm not trying to delete\n> the files from the repository, I just want free up space in idle\n> repositories.\n\nWell, that actually sounds like you might want to just make them totally \n\"bare\" repositories, ie you can just do something like\n\n\tmv repo/.git repo.git\n\trm -rf repo\n\nand then \"repo.git\" is a valid bare repository.\n\nHowever, if you actually want to just clear the checked-out files:\n\n> After mothballing the repository with git-repack -a -d and git clean\n> -d -x, is there a convenient one-liner to empty the files out the\n> working directory?\n\nWell, you can do\n\n\tgit ls-files -z | xargs -0 rm -f --\n\nor something, or indeed just do a \"rm -rf *\", since the only thing you \nactually would want to save is the \".git\" directory.\n\n\t\tLinus\n"},{"id":"23967","messageId":"81b0412b0607210008l45198948sab391a8cf94c7af8@mail.gmail.com","threadId":"4934","inReplyTo":"Pine.LNX.4.64.0607201944460.29649@g5.osdl.org","subject":"Re: Easy way to empty working tree?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-07-21T07:08:40Z","receivedAt":"2006-07-21T07:08:40Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/21/06, Linus Torvalds <torvalds@osdl.org> wrote:\n> > After mothballing the repository with git-repack -a -d and git clean\n> > -d -x, is there a convenient one-liner to empty the files out the\n> > working directory?\n>\n> Well, you can do\n>\n>         git ls-files -z | xargs -0 rm -f --\n>\n\nThat'd be not enough for kernel after it was compiled.\nMaybe this:\n\n   find . -maxdepth 1 -not -name .git -not -name . -print0 | xargs -0 rm -rf --\n"}]}