Skip to content

Instantly share code, notes, and snippets.

@rxa254
Last active March 14, 2021 23:26
Show Gist options
  • Save rxa254/2ce477f4302d4af88a283f37d70e0e17 to your computer and use it in GitHub Desktop.
Save rxa254/2ce477f4302d4af88a283f37d70e0e17 to your computer and use it in GitHub Desktop.
How to clean up large files from your GIT repo

Sometimes people (maybe mistakenly) upload large files to GIT which are not needed. We want our GIT repos to be small and only contain the necessary source files, i.e:

  1. not any large images
  2. not compiled PDF or object files
  3. not large data sets

Those large files which don't need version control can be managed using GIT-LFS.

We can do this using the useful GIT BFG: https://rtyley.github.io/bfg-repo-cleaner/

Remove manually all the current bad files

  1. First go through and delete all the current large files that you no longer want, e.g.: 'git rm *.mph'
  2. otherwise, these will be seen as 'protected' files and won't be removed by the BFG
  3. do a commit on all these deletions and push them to the branch (or master)

Start with a fresh checkout of a mirror

After manually removing and commiting, do a checkout of a fresh mirror: git clone --mirror git@github.com:CaltechExperimentalGravity/Qryo.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment