I have a .gitignore
file that looks like this:
*
!/src
!/resources
!/.gitignore
!/package.json
!/tsconfig.json
!/README.md
I added a file to a subdirectory in the src
folder src/config/mongo.ts
. However, when I try to add the file it doesn't get added:
git add -A
I have tried modifying the second line to each of the following:
!/src/
!/src/*
!/src/**/*
However it still doesn't add the file.
I have also tried adding the file directly:
git add src/config/mongo.ts
But I get the following message:
The following paths are ignored by one of your .gitignore files: src/config/mongo.ts
git status
only shows that the .gitignore
file has been changed. Not sure what to do to get this working.
I would like to:
*
src
directory (and its subdirectories)resources
directory (and its subdirectories)This one is a tricky one, took me forever to figure out when I originally ran into it.
You just need to soften the initial exclusion slightly:
/* # instead of just *