首页 > 解决方案 > 如何从 unstaged 选项卡中删除 node_modules?

问题描述

我在 Git 选项卡中有一些来自 node_modules 的未暂存文件。我想删除它们,因为文件太多而我看不到好的文件。这是我正在谈论的图片:

图片链接

我也尝试过让它们都变味,但它不起作用。我可以暂存普通文件,但从 node_modules/.bin 等它就在那里。

我有这个 .gitignore 文件:

/node_modules/*
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
.phpunit.result.cache

标签: gitatom-editor

解决方案


您可能已将 node_modules/ 添加到您的索引中。使用 git bash 转到该目录并从索引中删除 node_modules 目录并提交该更改:

git rm --cached -r node_modules
git commit -m "removing node_modules from index"

推荐阅读