Purge big files (and their version history) from a git repository

Alec Jacobson

December 23, 2015

weblog/

  1. fork the repo (e.g. using github web interface) and never touch the original again until confident that everything below worked
  2. clone fork
  3. cd fork
  4. git rm all big files
  5. git commit -m "removed big files"
  6. bfg --strip-blobs-bigger-than 20K .
  7. git reflog expire --expire=now --all && git gc --prune=now --aggressive
  8. git push origin --force master

Verify (e.g. on github website) that both repositories look as expected.