Obliterate Unsavory git Objects with the BFG

Sometimes we accidentally commit things to git that we shouldn’t. Passwords. Keys. Other sensitive data. Photoshop files. Intermediate object files. Other big binary data.

There’s a lot of stuff that doesn’t work well in git, and since git (conservatively and justifiably) makes it difficult to destroy data, we end up with these anchors slowing us down.

Thankfully, we now have the BFG Repo-Cleaner.

Demonic git blobs got you down? Time to bring out the BFG.
Demonic git blobs got you down?
Time to bring out the BFG.

I was recently migrating some repositories to GitHub when I bumped into their 100mb file size limit. I tried a variety of git-filter-branch commands, including GitHub’s suggestion, but to no avail. That Illustrator file just wouldn’t go away!

Thankfully I found the BFG, ran java -jar ~/Desktop/bfg-1.7.0.jar --delete-files WhoAmIBoy\(Round2\)_Med.ai doc.git, and the annoying AI file was vaporized more thoroughly than any other run-of-the-mill demon.

Be sure to try out the BFG next time you need to remove something from git history. Its home page has plenty of examples of how to remove specific files, objects over a certain size, and more.

Thank you to Roberto Tyley for the great work on this project!