Search code examples
gitignore

Subfolder's .gitignore should override


I have a project which tree structure looks like this:

+ /Root - .gitignore + - - /Folder A - - - .gitignore <--- this fellow + - - - /bin - - - - - fileA + - - - - fileB + - - - /Folder AA + - - /FolderB + - - - /bin ...

The .gitignore in the root-folder has a lot of rules, among them is to ignore all /bin-folders. However, in my FolderA I would like everything to stay as it is - all the way down in that folder. FolderB/bin on the other hand should be ignored.

I know this is possible by adding another .gitignore in FolderA, and let this override the root folder's .gitignore. But I can't remember how.

What should I write in FolderA/.gitignore?

Edit: In other words: "FolderA is a sacred folder, and must have all files in it stay in it, disregarding what any other .gitignore-files must say"


Solution

  • Solution found:

    In the .gitignore file added in the folder needed to be excluded, the following line is added as the only line:

    !*/