很大的文件一般都不要放上去,像 dist,node_modules这样的文件就不要放上去了,.gitignore的作用就是可以提交的时候把写入的文件不提交
要是不小心提交了,像我一样
把node_modules文件夹已经被提交到Git仓库中,您需要在.gitignore文件添加规则后,运行以下命令将其从仓库中删除:
1.git rm -r --cached node_modules
这将从Git仓库中删除已经提交的node_modules文件夹,但保留本地副本。然后,进行一次新的提交:2. git add .
3.git commit -m "Remove node_modules from repository"
如果你是刚提交也可以用git reset --soft HEAD^ 回退提交
然后再
2. git add .
3.git commit -m "Remove node_modules from repository"