← back to Designer Wallcoverings
PURGE-GIT-HISTORY.md
86 lines
# Purge Designer-Wallcoverings .git bloat (5.1 GB → ~0.3 GB)
**Why:** `.git` = 5.1 GB; `dw-backup-canary` FAILs on it every run. Breakdown:
`vendor-scrapers/` = **4.44 GB** (83%), and ~5.0 GB is images (.png/.webp/.jpg) — scraper
crops/build artifacts that never belonged in version control. No remote on this repo, so
**no force-push needed** — purely local rewrite.
**Destructive: rewrites history.** Steve runs this; Claude only drafted it. `git-filter-repo`
is installed (`/opt/homebrew/bin/git-filter-repo`).
---
## STEP 0 — backup first (non-negotiable)
```bash
cd ~/Projects
cp -a Designer-Wallcoverings Designer-Wallcoverings.prebloat-bak # full safety copy
cd Designer-Wallcoverings
git status # note any uncommitted work; commit or stash before rewriting
```
## STEP 1 — choose a target (A is recommended)
### A) Surgical — drop the vendor-scrapers/ tree from ALL history (recovers ~4.44 GB)
Removes those scraper images from history **and** the working tree (they're regenerable).
```bash
git filter-repo --force --invert-paths --path vendor-scrapers/
```
### A+) Also mop up the remaining big blobs in DW-Programming / DW-Websites (recovers ~another 0.4 GB)
Run AFTER A. Strips any remaining historical blob > 5 MB (old data dumps, site PNGs):
```bash
git filter-repo --force --strip-blobs-bigger-than 5M
```
### B) Alternative — purge by image type everywhere (recovers ~5.0 GB, but drops ALL tracked images incl. site/logo assets)
Only if you don't want ANY images tracked. More aggressive than A:
```bash
git filter-repo --force --invert-paths \
--path-glob '*.png' --path-glob '*.webp' --path-glob '*.jpg' \
--path-glob '*.jpeg' --path-glob '*.gif'
```
> **Keep current files on disk but purge history?** If you still need the current
> `vendor-scrapers/` images locally: move them aside first
> (`mv vendor-scrapers /tmp/vs-keep`), run A, then they simply stay untracked at
> `/tmp/vs-keep` — copy back what you need and let `.gitignore` (Step 3) keep them out.
## STEP 2 — reclaim the space
`filter-repo` already expires reflogs + repacks, but force it fully:
```bash
git reflog expire --expire=now --all
git gc --prune=now --aggressive
du -sh .git # expect ~0.2–0.4 GB
```
## STEP 3 — stop it coming back (append to .gitignore + commit)
```bash
cd ~/Projects/Designer-Wallcoverings
cat >> .gitignore <<'EOF'
# scraper image output + large data artifacts — never commit to history
vendor-scrapers/**/cropped/
vendor-scrapers/**/*.png
vendor-scrapers/**/*.webp
vendor-scrapers/**/*.jpg
**/data/gallery/renders.json
**/*.jsonl
EOF
git add .gitignore && git commit -m "gitignore scraper image output + large data artifacts (post history-purge)"
```
## STEP 4 — verify the canary clears
```bash
node ~/.claude/skills/dw-backup-canary/scan.mjs 2>&1 | grep -i 'designer-wallcoverings\|FAIL'
# Designer-Wallcoverings should no longer appear as a FAIL.
```
## STEP 5 — once you've confirmed everything's intact, drop the backup
```bash
rm -rf ~/Projects/Designer-Wallcoverings.prebloat-bak
```
---
**Recovery if anything looks wrong before Step 5:**
`rm -rf ~/Projects/Designer-Wallcoverings && mv ~/Projects/Designer-Wallcoverings.prebloat-bak ~/Projects/Designer-Wallcoverings`