3

I'm trying to make git ignore all files with extension .ex but only if they are in a subfolder with the name subf. In man gitignore I read the following:

Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:

   ยท   A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or
       directory "bar" anywhere that is directly under directory "foo".

However, if I put my **/subf/*.ex into .gitignore (in repository base directory) my files with .ex extension are not ignored! I read in this thread that I should add my exclusion rule to the file .git/info/exclude. This seems to work for me but I'm not happy with it since this is not how I understood .gitignore. Can somebody help me understand why putting **/subf/*.ex does not work in .gitignore. Thank you!

Community
  • 1
  • 1
Jakob Wachtel
  • 31
  • 1
  • 2

1 Answers1

1

why not as simple as,

 subf/*.ex

Or if you are expecting subf at any level,

**/subf/*.ex

It is working for me

kamoor
  • 2,909
  • 2
  • 19
  • 34