Whitelist folder inside ignored folder [duplicate]

与世无争的帅哥 提交于 2019-12-20 06:07:16

问题


I have a node.js project with some node_modules. Now a node_module was not upto expectations and I manually changed, compiled and put it back into the node_module folder.

I want to add this module to the GIT, however, the node_modules are listed in my gitignore (obviously).

I tried the following

/node_modules !/node_modules/the_module/**

But files are not showing up when doing git status

Is it possible to whitelist one package inside a ignored folder?


回答1:


Ok so basically the answer is:

/node_modules/*
!/node_modules/the_module



回答2:


Try adding the files manually (generally this takes precedence over .gitignore-style rules):

git add /path/to/module

You may even want the -N intent to add flag, to suggest you will add them, but not immediately. I often do this for new files I’m not ready to stage yet.



来源:https://stackoverflow.com/questions/56480490/whitelist-folder-inside-ignored-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!