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,579
  • 13
  • 25
Paul
  • 25,812
  • 38
  • 124
  • 247

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,594
  • 3
  • 28
  • 35
  • 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
  • 755,051
  • 104
  • 632
  • 656
  • 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