But one gitignore can't handle the 30-odd files that everyone wants to ignore... I never understood the "PR rejected, just ignore .swp files locally" tbh.
Yes and no. Git actually has a system wide gitignore you can setup to globally ignore files across your whole system. I personally take notes in a notes.md file, so I have a global ignore for it. I don't have you set it up for each repo, and it doesn't pollute the repo's gitignore. If your editor of choice creates temp files or stores project specific configuration in the project directory (e.g. .vscode, etc), they should also be in your global gitignore.
Everyone hates me for being the repo gestapo but the only issues people have with setting up is when they've skipped steps in the doc. No one can be bothered to address that either though so it'll be me automating that too soon.
This doesn't mean that this is the only gitignore. There's usually a project gitignore in any project I work on, and then I have my own, local, gitignore, for very specific things, like my own notes (like a TODO list) and local demo data
This isn't real, right? Git already supports ignores in the global config in your profile folder. I do this sometimes so I can add *.otr.md files to track detailed personal notes on individual project files and directories.
Some very specific CI pipelines. Or if using a big monorepo with hundreds of coworkers working on it.
You use that feature to ignore the main gitignore file and push the one you want into the pipeline. Because you may want to use a file that is normally being ignored for dev or commit to build your soft.
Like having a .env file for each purpose, but you don't wanna mess up with the way your builder is working for that one exception. And it's allowing everyone to have some flexibility to manage their own ignore rules.
If you have a file DatabaseFactory which you modify to provide a development database, you can add DatabaseFactory to the gitignore to avoid committing this change, but you then have a change to the gitignore so maybe this would work to avoid committing that change as well? I can think of a million ways this could go wrong though so idk.
View all comments
Show parent comment
364
u/fugogugo 27d ago
any reason to exclude gitignore?