背景
有一个github仓库,里面有好多react项目,或者其他项目,项目里面有好多node_modules,目标忽略掉node_modules
具体操作
- 在本地文件夹里面,创建一个.gitignore 文件夹,里面填写
//使用*通配多个字符,把仓库下所有node_modules忽略掉 *node_modules/*
- 第二种情况,已经把node_modules传到github,那怎么整。在第一种方法下,依旧有node_modules 被上传,使用下面这个
//发现有不该提交的文件已经提交后,清除后再上传
git rm -r --cached xxx(删除的文件夹名字)
git add .
git commit -m 'remove node_modules and dist'
git push