The pattern you provided /public/static/**/*.js gitignore file in any given directory of your repo will affect that directory and all subdirectories.
What this means is that the patterns in a. gitignore file in the same directory as the path, or in any parent directory, with patterns in the higher level files (up to the toplevel of the work tree) being overridden by those in lower level files down to the directory containing the file. UPDATE: Take a look at answer: Git now supports the ** syntax in patterns.