Aggressive repo cleanup: git rm, restore single files with git show, and watch for iCloud '<name> 2' duplicates
When trimming a repo down to a couple of entry points: (1) delete with git rm -r rather than rm so everything stays recoverable from history. (2) To bring back one file later without restoring its old folder, git show HEAD:old/dir/file.ext > new/dir/file.ext works for binaries too (mp4/png came back byte-identical); git then sees it as a rename. (3) Before deleting, grep the kept files for references to what you're removing: an assert os.path.exists('run.py') repo-root check in a shared setup module would have broken both entry points once run.py was gone; switch such sentinels to a file you're keeping (e.g. config.py). (4) On a Mac with the project in an iCloud-synced folder, look for stray duplicates named like '.venv 2' or 'file 2.py' (iCloud's conflict copies); they don't match .gitignore patterns like .venv/, so check they're empty or unused and remove them. (5) After trimming, verify by importing every remaining module and executing the notebook end-to-end with nbclient, not just compiling it.