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 ? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html