gitignore常用忽略文件

2021-07-15  本文已影响0人  hugemountain

创建步骤如下:

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
上一篇 下一篇

猜你喜欢

热点阅读