docs: 新增 gitignore 配置参考(base/java/dotnet/go/nodejs/python)

This commit is contained in:
2026-07-18 21:31:20 +08:00
parent 3295a78cc5
commit 4d19690673
7 changed files with 240 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
# 常见语言的 .gitignore 配置参考
按语言/工具分目录,每个目录一个可直接复制到项目根目录的 `.gitignore`:
| 目录 | 适用场景 |
| --- | --- |
| `base` | 通用:操作系统、编辑器、日志、压缩包(各语言配置都会引用它) |
| `java` | Maven / Gradle 项目,含 IDE 工程文件(`.idea`、`*.iml`) |
| `dotnet` | .NET 项目(`bin/`、`obj/`、`*.user`) |
| `go` | Go 模块项目(编译产物、覆盖率、`vendor/` 按需启用) |
| `nodejs` | Node.js / 前端项目(`node_modules/`、构建产物、日志) |
| `python` | Python 项目(`__pycache__/`、虚拟环境、测试与打包缓存) |
各文件内容取自 GitHub 官方 `github/gitignore` 模板并做了精简,保持了与 `configs/dockerignore` 一致的目录结构:
需要哪种语言就复制对应目录的 `.gitignore`,跨语言的项目可把多个文件内容合并到项目根目录的 `.gitignore`。
> 说明:仓库根目录自己的 `.gitignore` 已经存在,不要把这里的文件直接覆盖过去,按需合并即可。
+23
View File
@@ -0,0 +1,23 @@
# ---- 操作系统 ----
.DS_Store
._*
.Spotlight-V100
.Trashes
Thumbs.db
ehthumbs.db
Desktop.ini
# ---- 编辑器 / IDE ----
.vscode/
.idea/
*.swp
*.swo
*~
.tags
# ---- 日志与临时文件 ----
*.log
logs/
tmp/
*.tmp
*.bak
+42
View File
@@ -0,0 +1,42 @@
# ---- 编译输出 ----
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
*.dll
*.exe
*.pdb
*.cache
# ---- 构建工具 ----
artifacts/
.vs/
*.user
*.suo
*.userosscache
*.sln.docstates
*.rsuser
# ---- 调试 / 测试 ----
*.[Cc]ache
TestResults/
*.trx
coverage*.json
coverage*.xml
coverage*.info
*.coverage
*.coveragexml
# ---- 发布 / NuGet ----
publish/
*.nupkg
*.snupkg
.nuget/
packages/
project.lock.json
# ---- ReSharper / Rider ----
_ReSharper*/
*.DotSettings.user
.idea/
+26
View File
@@ -0,0 +1,26 @@
# ---- 编译产物 ----
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
bin/
dist/
# ---- 测试与覆盖率 ----
coverage.out
coverage.html
*.coverprofile
profile.cov
# ---- Go 工作区 / 模块缓存 ----
go.work
go.work.sum
vendor/
# ---- 工具 ----
.golangci.yml
.tool-versions
# go.sum 与 go.mod 应当提交,不要忽略
+43
View File
@@ -0,0 +1,43 @@
# ---- 编译产物 ----
target/
build/
out/
bin/
*.class
*.jar
*.war
*.ear
*.log
# ---- Maven ----
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
dependency-reduced-pom.xml
# ---- Gradle ----
.gradle/
!gradle/wrapper/gradle-wrapper.jar
build/
!**/src/main/**/build/
!**/src/test/**/build/
# ---- IDE ----
.idea/
*.iml
*.ipr
*.iws
.settings/
.classpath
.project
.apt_generated
*.launch
.factorypath
# ---- 其它 ----
hs_err_pid*
replay_pid*
*.hprof
+39
View File
@@ -0,0 +1,39 @@
# ---- 依赖 ----
node_modules/
jspm_packages/
bower_components/
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# ---- 日志 ----
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# ---- 构建产物 ----
dist/
build/
.output/
.next/
.nuxt/
.cache/
.parcel-cache/
.eslintcache
coverage/
*.tsbuildinfo
# ---- 环境变量 ----
.env
.env.*
!.env.example
# ---- 其它 ----
.npm
.pnpm-store/
*.tgz
+50
View File
@@ -0,0 +1,50 @@
# ---- 字节码 / 缓存 ----
__pycache__/
*.py[cod]
*$py.class
*.so
.python
# ---- 打包 / 构建 ----
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# ---- 虚拟环境 ----
.venv/
venv/
env/
ENV/
.env
.env.*
!.env.example
# ---- 测试与类型检查缓存 ----
.pytest_cache/
.coverage
.coverage.*
htmlcov/
.tox/
.nox/
.hypothesis/
.mypy_cache/
.dmypy.json
.ruff_cache/
.pytype/
# ---- PyInstaller / Jupyter ----
*.manifest
*.spec
.ipynb_checkpoints/