在項目的根目錄,右鍵選擇 Git Bash
進入命令行;
在命令行輸入:
touch .gitignore
生成 .gitignore
文件;
在文件中輸入過濾信息,過濾規則如下:
node_modules/ 表示過濾這個文件夾
*.zip 過濾zip后綴文件
demo.html 過濾該文件
我的項目中配置的是:
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# 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*