Reputation: 3501
I am working on a node js project and I am creating a node module that for now want have it added to the project I am working on. So in my gitignore I put the following but it did not work
node_modules/*
!node_modules/zephyr-rest
The zephyr-rest is a directory, so I want just that directory and its files to be saved. I do not want any other sub directory under node_modules to be versioned. Thanks
Upvotes: 1
Views: 364
Reputation: 25882
Try this, worked for me.
node_modules/*
!node_modules/zephyr-rest/
After git status
it will show like this
Untracked files:
(use "git add <file>..." to include in what will be committed)
node_modules/
Don't worry because git status
just tells the top-most untracked folder as untracked
not every subfolder, so this tells there is an untracked folder node_modules
. Doing git add node_modules
should add just node_modules/zephyr-rest/
Upvotes: 5