| name | garbage-collect |
| description | Manage files in /garbage folder for deletion |
Created: 2026-02-09-00-00
Last Updated: 2026-02-09-00-00
Garbage Collection for File Deletion
When you lack permissions to delete files directly, move them to /garbage folder. This command helps manage that folder.
Moving Files to Garbage
When you want to delete a file but can't:
mkdir -p garbage
mv path/to/file.ext garbage/
mv path/to/directory garbage/
Important: All files should be preserved in git history before moving to garbage.
Verify Files in Git History
Before moving files to garbage:
git log -- path/to/file.ext
git add path/to/file.ext
git commit -m "Archive: [file.ext] before deletion"
mv path/to/file.ext garbage/
Check Garbage Folder
ls -lh garbage/
du -sh garbage/
Add to .gitignore
Ensure garbage folder is ignored:
grep -q "^garbage/$" .gitignore || echo "garbage/" >> .gitignore
User Cleanup
The user will periodically run:
ls -la garbage/
rm -rf garbage/*
rm -rf garbage/
Pre-Garbage Checklist
Before moving anything to garbage:
Example Workflow
git log -- old-component.tsx
git grep "old-component"
mkdir -p garbage
mv src/components/old-component.tsx garbage/
git add -A
git commit -m "Remove old-component.tsx (moved to garbage)"
Bulk Garbage Collection
When moving many files:
GARBAGE_DATE=$(date +%Y%m%d-%H%M)
mkdir -p "garbage/${GARBAGE_DATE}"
mv path/to/old-files/* "garbage/${GARBAGE_DATE}/"
cat > "garbage/${GARBAGE_DATE}/MANIFEST.md" <<EOF
# Garbage Collection
**Date:** $(date +"%Y-%m-%d-%H-%M")
**Reason:** [Why these files were removed]
## Files Removed
$(ls -1 "garbage/${GARBAGE_DATE}/")
## Git References
These files are preserved in git history before this commit:
$(git log -1 --oneline)
EOF
This helps user understand what's in garbage when they review it.