我有一个项目包含多个其他项目:

主要项目 小项目1 小项目2

所有包含node_modules文件夹。我想要git忽略文件夹,无论它是从根文件夹开始的位置。在.gitignore中添加如下内容:

*node_modules/*

当前回答

只需在小项目1和小项目2中添加不同的.gitignore文件。每个.gitignore文件都应该/node_modules,这样就可以了。

其他回答

只需在小项目1和小项目2中添加不同的.gitignore文件。每个.gitignore文件都应该/node_modules,这样就可以了。

添加node_modules / 或node_modules 到.gitignore文件,忽略当前文件夹中所有名为node_modules的目录和如下图所示的子文件夹。

你也可以用SVN/Tortoise git来做。

只需右击node_modules ->乌龟git ->添加到忽略列表。

这将为你生成. gitignore,你不会再在staging中找到node_modules文件夹。

在Mac,

打开sourcetree 点击特定项目 点击设置 单击高级 点击编辑gitignore 写“node_modules” 并保存。

在.gitignore中添加下面的行将忽略整个存储库中的节点模块。

node_modules