Skip to content

Instantly share code, notes, and snippets.

@seabbs
Last active April 7, 2020 11:31
Show Gist options
  • Save seabbs/b1f69bd3a2439a7728aad2b7aa5f1450 to your computer and use it in GitHub Desktop.
Save seabbs/b1f69bd3a2439a7728aad2b7aa5f1450 to your computer and use it in GitHub Desktop.
Clean .rds and .png from git histories using BFG
#!bin/bash
## This requires java and bfg to be installed
## bfg: https://rtyley.github.io/bfg-repo-cleaner/
## Assumes that the repo is in the current directory
## Remove all .rds and .png from the Git history
java -jar bfg.jar --delete-files "*.rds" $1
java -jar bfg.jar --delete-files "*.png" $1
## Move into repo and prune to apply changes
cd $1
git reflog expire --expire=now --all && git gc --prune=now --aggressive
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment