I made a mistake and pushed several big audio files to my GitHub repo a while back. These files are taking up tons of storage space in my account and I need to get rid of them completely.
The problem is that these files were added in previous commits, not the most recent one. So just deleting them from the current version won’t help because they’re still stored in the git history.
Does anyone know how to permanently remove files from git history? I’ve heard about tools that can rewrite commit history but I’m not sure which one to use or how to do it safely. Any step-by-step guidance would be really helpful since I don’t want to mess up my repository.
git filter-repo is def the way to go, way simpler than filter-branch. Just back up your repo before, then do git filter-repo --invert-paths --path path/to/your/audiofile.wav. Remember to force push after! It fixed my repo issue with big files.
Had the same problem - video files pushed my repo over 500MB. BFG Repo-Cleaner saved me. It’s way faster than git filter-repo for big repos. Download the jar, make a fresh clone with --mirror, then run java -jar bfg.jar --delete-files "*.wav" your-repo.git. Heads up: warn your collaborators first since this rewrites history completely. After BFG runs, you’ll need git reflog expire --expire=now --all and git gc --prune=now --aggressive to actually free the space, then force push. Took me 10 minutes and shrunk my repo from 500MB to 50MB.