Can you have additional .gitignore per directory within a single repo?
GitVersion ControlRepositoryGitignoreGit Problem Overview
Can you create a .gitignore file in a directory that only applies to files (and directories) within that directory?
Git Solutions
Solution 1 - Git
Yes, you can. Try it, it works fine. Put a .gitignore
in the root of your repo, and put another .gitignore
with additional things to ignore in a subdirectory.
Solution 2 - Git
Similar question was: https://stackoverflow.com/questions/3305869/are-multiple-gitignores-frowned-on (Jul 2010)
Or if you can have different version of a .gitignore
file per branch: https://stackoverflow.com/questions/2250040/using-github-to-host-public-git-repositories-whilst-ensuring-that-sensitive-data/2250144#2250144 (Feb 2010)
Further perhaps related: https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-s/930495#930495
Solution 3 - Git
You can just specify files to ignore in a format such as
Xyz/*.abc
in the .gitignore in the root directory, potentially removing the need for separate ignore files.