(20251205)清理 Play 2.1 專案的建置產物
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/1295
最近在 VS Code 的變更列表裡冒出三百多條修改,主要是 Play/SBT 的建置產物與 Ivy 快取。它們可隨時重建,不應納入 Git。以下記錄這次清理過程。
操作步驟
- 在倉庫根目錄更新 `.gitignore`,加入 Play/SBT 生成的目錄(`application/tsk/target`、`.target`、`logs`、`RUNNING_PID` 等)以及本地 `repository` 快取。
- 移除不存在的路徑(如 `dist`、`.history`),避免 `git rm` 報錯。
- 將已被追蹤的產物從索引移除:
cd "/c/Program Files/play-2.1.5/play-2.1.5"
git rm -r --cached \
application/tsk/target application/tsk/.target application/tsk/logs \
application/tsk/RUNNING_PID \
application/tsk/project/target application/tsk/project/project \
repository
git status
+:
git rm --cached application/tsk/.project
This article was last edited at