在git管理的项目根目录,可以创建一个 .gitignore文件, 把不需要添加到git中的目录写入这个文件,相当于git黑名单, 不会被提交到git仓库, 针对一些模块包和测试,打包,缓存,临时文件
格式如下: 注释以 # 开头
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
Git管理:使用.gitignore忽略特定文件
在Git项目中,可以通过创建.gitignore文件排除不需版本控制的文件,如依赖包(node_modules),测试覆盖率(testing/coverage)、构建产物(production/build)、配置文件.env*和日志文件(npm-debug.log等)。
598

被折叠的 条评论
为什么被折叠?



