Does the .gitignore file belong in the .git folder structure somewhere or in the main source files?
As the other answers stated, you can place .gitignore
within any directory in a Git repository. However, if you need to have a private version of .gitignore
, you can add the rules to .git/info/exclude
file.
You can place .gitignore in any directory in git.
It's commonly used as a placeholder file in folders, since folders aren't usually tracked by git.