2

What is the right syntax of .gitignore to exclude all the *.cache files in all subdirectories of /StringsEditor directory?

I tried both /StringsEditor/*.cache and /StringsEditor/*/*.cache but none of them works.

Pankit Kapadia
  • 1,569
  • 13
  • 25
Paul
  • 24,778
  • 37
  • 115
  • 228

2 Answers2

5

This is probably the result of a misunderstanding. Paths in .gitignore do not need to be relative to the root of the repository. I.e. you could ignore just *.cache. If you actually do only want this to occur for StringsEditor subdirectories, then you can use StringsEditor/**/*.cache.

More information here.

Community
  • 1
  • 1
Martin Foot
  • 3,504
  • 2
  • 26
  • 34
  • The true reason was that I should also remove corresponding files from git to make them untracked. – Paul Dec 24 '12 at 13:09
3

Just put *.cache in StringsEditor/.gitignore.

CB Bailey
  • 700,257
  • 99
  • 619
  • 646
  • Let me mark your reply as the cleverest one. I have nearly forgotten that .gitignore could be in every folder. – Paul Dec 24 '12 at 13:15