.gitignore Question

Can someone confirm that filenames in .gitignore are matched in any directory?

Ex: If I have an entry fred.txt that’ll match:

  • /fred.txt
  • /org/someco/whateverpackage/fred.txt
  • etc

Hello @kingthorin,

Yes, files with the same name and extension will be ignored, even in other directories.

1 Like

A little additional detail that may be useful sometimes: It will match in subdirectories. So patterns in /.gitignore will match anywhere in the repository, but if you have e.g. an /org/.gitignore the patterns in there will only match in the /org directory.

1 Like