一个好用的 .gitignore 文件示例

分享一个自用的 .gitignore 配置

发布于  星期三,五月 22 2024

.gitignore 是每个 Git 项目必备的文件用来忽略不想被 Git 管理的文件或文件夹

Go 项目

来自模板:https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# Mac OS
.DS_Store

# IDEA config
.idea

# Go air build output dir
tmp/

前端项目

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal

# next.js
/.next/
/out/
next-env.d.ts

.env.production
.env.development
.env

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# vercel
.vercel

# typescript
*.tsbuildinfo

# next-sitemap在build生成的文件
/public/robots.txt
/public/*.xml
  • 项目工程化