{"thread":{"id":"28602","subject":"List of directories containing only ignored files","startedAt":"2011-10-06T13:56:37Z","lastAt":"2011-10-06T14:32:39Z","messageCount":3,"participants":["Marcin Wiśnicki","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"177028","messageId":"CAC9GOO__nN9W1vvoMxq2LKnn=YoFPjTE6jKPbQ2h7im3JtujQA@mail.gmail.com","threadId":"28602","inReplyTo":null,"subject":"List of directories containing only ignored files","fromName":"Marcin Wiśnicki","fromEmail":"mwisnicki@gmail.com","sentAt":"2011-10-06T13:56:37Z","receivedAt":"2011-10-06T13:56:37Z","isPatch":false,"sender":{"key":"mwisnicki@gmail.com","avatar":"https://gravatar.com/avatar/6bc6cce46e549217fe39b05ac03acb4f5755154d6752ff65b580783365ad3e50?d=mp&s=160"},"body":"What's the easiest way to find all directories that contain only\nignored files but are not ignored themselves.\n\nFor example, given following .gitignore:\n\n  obj/\n\nand following files:\n\n  /project1/foo.c\n  /project1/obj/foo.o\n  /project2/obj/bar.o\n\nWhere /project2 contains leftovers from different branch that are not\ncleared on switch because they are ignored.\n\nI would like to see:\n\n  /project2\n\n\nAlternatively: how to remove such leftovers when switching branches ?\n"},{"id":"177029","messageId":"4E8DB548.5030108@op5.se","threadId":"28602","inReplyTo":"CAC9GOO__nN9W1vvoMxq2LKnn=YoFPjTE6jKPbQ2h7im3JtujQA@mail.gmail.com","subject":"Re: List of directories containing only ignored files","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2011-10-06T14:03:52Z","receivedAt":"2011-10-06T14:03:52Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"On 10/06/2011 03:56 PM, Marcin Wiśnicki wrote:\n>\n> Alternatively: how to remove such leftovers when switching branches ?\n\ngit clean -X -f\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"177030","messageId":"CAC9GOO_edkZxU=eO93fuCiV0vFaQjcnj7u8FUPYs-1hXrQX48A@mail.gmail.com","threadId":"28602","inReplyTo":"4E8DB548.5030108@op5.se","subject":"Re: List of directories containing only ignored files","fromName":"Marcin Wiśnicki","fromEmail":"mwisnicki@gmail.com","sentAt":"2011-10-06T14:32:39Z","receivedAt":"2011-10-06T14:32:39Z","isPatch":false,"sender":{"key":"mwisnicki@gmail.com","avatar":"https://gravatar.com/avatar/6bc6cce46e549217fe39b05ac03acb4f5755154d6752ff65b580783365ad3e50?d=mp&s=160"},"body":"2011/10/6 Andreas Ericsson <ae@op5.se>:\n> On 10/06/2011 03:56 PM, Marcin Wiśnicki wrote:\n>>\n>> Alternatively: how to remove such leftovers when switching branches ?\n>\n> git clean -X -f\n>\n\nThat also would delete /project1/obj/foo.o which is not what I wanted.\n\nAnyway I think I have found the answer:\n\n git ls-files -o --directory --exclude-standard\n"}]}