Skip to content

[1.5.2 Patch][P1] 仓库卫生清理:移除已追踪的 IDE、缓存和构建产物 #76

Description

@weidonglang

背景

.gitignore 已经忽略 .idea/__pycache__/build/dist/tauri/dist/tauri/src-tauri/target/ 等,但仓库页面仍能看到部分 IDE 配置、Python 缓存或构建产物目录。

这说明这些内容可能已经被历史提交追踪,.gitignore 无法自动移除已追踪文件。

风险

  • GitHub 语言统计异常。
  • 仓库体积增大。
  • 软著前源代码材料不干净。
  • 可能泄露本地路径、IDE 配置或构建中间文件。
  • 降低开源项目专业度。

清理范围

检查并移除已追踪的:

.idea/
.vscode/,如包含个人配置
__pycache__/
.pytest_cache/
build/
dist/
taouri/dist/ 或 tauri/dist/
taori/src-tauri/target/ 或 tauri/src-tauri/target/
*.pyc
*.pyo
*.toc
*.spec 中如仅旧 Python 打包遗留,需确认是否保留
release-assets/ 本地产物
node_modules/

注意:如果某些旧版 Python 文件仍作为历史兼容源码保留,可以保留源码,但不要保留构建产物和缓存。

执行要求

  • 不要使用 git add .
  • 使用精确路径执行 git rm -r --cached <path>
  • 清理前先 git status --short
  • 清理后确认源码、docs、tauri 配置仍存在。
  • 不要删除用户本地文件,只从 Git 追踪中移除。

建议命令

git status --short
git rm -r --cached .idea __pycache__ build dist 2>$null
git rm -r --cached tauri/dist tauri/src-tauri/target 2>$null
git status --short

实际命令以存在路径为准。

增加仓库卫生检查脚本

新增脚本,例如:

scripts/check_repo_hygiene.py

检查:

  • 已追踪文件中不包含 target/node_modules/dist/build/.idea/__pycache__/
  • 不包含常见大文件产物。
  • 不包含 .env、私钥、token 文件。

验收标准

  • 仓库不再追踪 IDE/cache/build/dist 产物。
  • .gitignore 与实际追踪状态一致。
  • 新增 repo hygiene 检查脚本。
  • python scripts/check_repo_hygiene.py 通过。
  • cargo test --all-targets 通过。
  • npm run build 通过。
  • docs/release-v1.5.2.md 记录该仓库卫生修复。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions