Lets say I have ".foo" in my global .gitignore and that works great for all of my current projects (and lets say that there is a lot of them, so I want to keep this in my global ignore file).
Now, I'm starting a new project that uses .foo files everywhere.
How can I "undo" the exclusion of .foo files defined in my global ignore for just this specific project?
This means I can just git add . when working with the new project and have it pick up all the .foo files, but if I run git add . in any other project then the .foo files are ignored.
You can simply unignore a pattern by add a leading !, like this:
# Don't ignore .foo file
!.foo
If you put this in your local .gitignore, it will override settings done in the global .gitignore.
You can find the documentation for supported patterns in gitignore in the official documentation here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With