美文网首页
gitignore常用忽略文件

gitignore常用忽略文件

作者: hugemountain | 来源:发表于2021-07-15 14:52 被阅读0次

创建步骤如下:

1.打开git bash

2.进入对应的目录,确保与.git在同一目录下

3.执行 touch .gitignore

4.编辑.gitignore文件 将提交需要排除的文件夹放入.gitignore文件中


.DS_Store

node_modules/

/dist

# local env files

.env.local

.env.*.local

# Log files

npm-debug.log*

yarn-debug.log*

yarn-error.log*

pnpm-debug.log*

# Editor directories and files

.idea

.vscode

*.suo

*.ntvs*

*.njsproj

*.sln

*.sw?

.rar

2删除已提交的文件

上传代码的时候忘记写 gitignore 了,一不小心把 node_modules 也传上去了,这破玩意体积巨大,所以要从上面删除。

git rm -r --cached node_modules/
git commit -m "删除node_modules"
# 再提交就没有了
git push origin

相关文章

网友评论

      本文标题:gitignore常用忽略文件

      本文链接:https://www.haomeiwen.com/subject/gvappltx.html