How can I Git ignore subfolders / subdirectories?
06:59 30 Mar 2010

I have a lot of projects in my .NET solution. I would like to exclude all "bin/Debug" and "bin/Release" folders (and their contents), but still include the "bin" folder itself and any DLL files contained therein.

.gitignore with "bin/" ignores "Debug" and "Release" folders, but also any DLL files contained in the "bin" folder.

bin/Debug or bin/Release in the .gitignore file does not exclude the directories unless I fully qualify the ignore pattern as Solution/Project/bin/Debug—which I don't want to do as I will need to include this full pattern for each project in my solution, as well as add it for any new projects added.

How can I do it?

git directory ignore gitignore