0

I have a .gitignore file with the following:

cache/

resources/

The file correctly matches the directories in my root:

cache/

resources/

The files in these directories are ignored and therefore because this is a git system, the directories themselves are ignored. This is also good.

But it also matches a sub directory in a sibling root directory:

default/cms/resources/library/index.cfm

And ignores this path which is not good.

How can I rewrite the .gitignore file so that:

default/cms/resources/library/index.cfm

Is not matched?

And only files & subdirectories inside cache/ & resources/ are matched.

Thank you in advance for any advice you can give me.

Charles Robertson
  • 1,760
  • 16
  • 21

1 Answers1

1

If anyone is interested, I have done some in depth tests using .gitignore [which I probably should have done in the first place, but I guess I was just being lazy], and the answer to the question is:

cache/**
resources/**

I hope this helps anyone, in a similar situation...

Charles Robertson
  • 1,760
  • 16
  • 21
  • I honestly have not used `**` which is supposed to be a recursive version of `*`. According [here](http://stackoverflow.com/questions/681262/difference-in-the-paths-in-gitignore-file) it is system dependent. [This doc](http://git-scm.com/docs/gitignore) says that `resources/**` will exclude everything from the directory `resources` relative to the location of `.gitignore`. You just solved your own post. Cheers :) – alvits Nov 17 '15 at 22:38
  • @alvits It seems to be both recursive to its direct descendants & recursive in sibling directories. In fact, it seems to cover everything! – Charles Robertson Nov 17 '15 at 23:57
  • @alvits "Excludes everything relative to .gitignore..." Now, this makes sense, in relation to why it covers sibling directories. Thanks for the explanation. – Charles Robertson Nov 18 '15 at 00:01