Lets say we want to add any and all folders called “build” regardless of where in the directory structure.
Git will by default check each file (and directory), adding limitations will limit when the pattern matches, so actually just typing what you wish to ignore is a global patter.
With git this would be done by adding the following to the .gitignore file
#ignore the folder called build anywhere, but not files called build build/ |
Also note that if the directory is already tracked in git, .gitignore will not affect that – it will remain tracked and changes can be committed etc.
Since this has a “/” at the end only directories would be matched – removing it would also make the pattern catch files with the same name.