Make gitignore include an ignored file or folder
We can use the literal
! to make gitignore include an ignored file or folder by negating a pattern.
Assuming we have a new initialized repo with the following structure:
If we were to do a dry-run for adding the files we’d get:
Now let’s use the wildcard to ignore all the text files inside the
Now we can use the
! literal to actually include one of the ignored files: