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\" folde
The question isn't asking about ignoring all subdirectories, but I couldn't find the answer anywhere, so I'll post it: */*
.
The generic way to ignore all subfolders, while continuing to track the files that are in the /bin
directory would be to add the following line to your project's .gitignore file:
bin/*/*
If you want to ignore only particular named subfolders, you can do:
bin/Debug/*
bin/Release/*
nb. if the bin
directory is not in the root of your project (alongside the .gitignore file), then instead of eg. bin/*/*
you might need path/to/bin/*/*
Have you tried wildcards?
Solution/*/bin/Debug
Solution/*/bin/Release
With version 1.8.2 of git, you can also use the **
wildcard to match any level of subdirectories:
**/bin/Debug/
**/bin/Release/
To exclude content and subdirectories:
**/bin/*
To just exclude all subdirectories but take the content, add "/":
**/bin/*/
To ignore all subdirectories you can simply use:
**/
This works as of version 1.8.2 of git.
The only way I got this to work on my machine was to do it this way:
# Ignore all directories, and all sub-directories, and it's contents:
*/*
#Now ignore all files in the current directory
#(This fails to ignore files without a ".", for example
#'file.txt' works, but
#'file' doesn't):
/*.*
#Only Include these specific directories and subdirectories:
!wordpress/
!wordpress/*/
!wordpress/*/wp-content/
!wordpress/*/wp-content/themes/
Notice how you have to explicitly allow content for each level you want to include. So if I have subdirectories 5 deep under themes, I still need to spell that out.
This is from @Yarin's comment here: https://stackoverflow.com/a/5250314/1696153
These were useful topics:
I also tried
*
*/*
**/**
and **/wp-content/themes/**
or /wp-content/themes/**/*
None of that worked for me, either. Lots of trail and error!