Re:Git ignores .gitignore with .gitignore in .gitignore
by CorrectHorseBat on Wednesday May 18, 2022 @07:24AM
(#31421425)
It would also come into play of you add code that generates files which should be ignored, but you don't realize the gitignore has to be updated because it's ignored in your own global gitignore.
Re:Git ignores .gitignore with .gitignore in .gitignore
by diarrhea on Wednesday May 18, 2022 @07:44AM
(#31421564)
Very good observation. That's a reason I'm itching to try out an approach akin to this (in a future project): https://jasonstitt.com/gitignore-whitelisting-patterns
Re:Git ignores .gitignore with .gitignore in .gitignore
by nishs on Wednesday May 18, 2022 @10:02AM
(#31422889)
Excellent point!
Tangentially, to prevent scenarios where generated code becomes out of sync, in your CI you should always re-run generators and check that `git status` shows no entries (and fail the build if it does).
If another developer has added a 'source.file' and you pulled it in, your global gitignore would not be triggered, since the file is already tracked in the repo.