From: Marcin Wiśnicki Date: Thu, 06 Oct 2011 13:56:37 GMT Subject: List of directories containing only ignored files Message-ID: What's the easiest way to find all directories that contain only ignored files but are not ignored themselves. For example, given following .gitignore: obj/ and following files: /project1/foo.c /project1/obj/foo.o /project2/obj/bar.o Where /project2 contains leftovers from different branch that are not cleared on switch because they are ignored. I would like to see: /project2 Alternatively: how to remove such leftovers when switching branches ?