忽略文件夹内的白名单文件夹
Whitelist folder inside ignored folder
我有一个 node.js 项目,其中有一些 node_modules。现在一个node_module不符合预期,我手动更改,编译并把它放回node_module文件夹。
我想将此模块添加到 GIT,但是,node_modules 列在我的 gitignore 中(很明显)。
我尝试了以下
/node_modules
!/node_modules/the_module/**
但是执行 git status
时文件没有显示
是否可以将一个被忽略的文件夹中的一个包列入白名单?
好的,基本上答案是:
/node_modules/*
!/node_modules/the_module
尝试手动添加文件(通常这优先于 .gitignore
风格的规则):
git add /path/to/module
您甚至可能想要 -N
intent to add 标志,建议您将 添加它们,但不是立即.我经常为尚未准备好暂存的新文件执行此操作。
我有一个 node.js 项目,其中有一些 node_modules。现在一个node_module不符合预期,我手动更改,编译并把它放回node_module文件夹。
我想将此模块添加到 GIT,但是,node_modules 列在我的 gitignore 中(很明显)。
我尝试了以下
/node_modules
!/node_modules/the_module/**
但是执行 git status
是否可以将一个被忽略的文件夹中的一个包列入白名单?
好的,基本上答案是:
/node_modules/*
!/node_modules/the_module
尝试手动添加文件(通常这优先于 .gitignore
风格的规则):
git add /path/to/module
您甚至可能想要 -N
intent to add 标志,建议您将 添加它们,但不是立即.我经常为尚未准备好暂存的新文件执行此操作。