Download Latest Version v1.15.0 source code.zip (1.0 MB)
Email in envelope

Get an email when there's a new version of BFG Repo-Cleaner

Home / v1.12.5
Name Modified Size InfoDownloads / Week
Parent folder
Git LFS support.tar.gz 2015-09-04 178.5 kB
Git LFS support.zip 2015-09-04 353.4 kB
README.md 2015-09-04 1.6 kB
Totals: 3 Items   533.5 kB 1

You can now use the BFG to convert an existing Git repository to the Git LFS format - so all your huge files can be extracted and safely replaced with Git LFS pointer files throughout your repository history. The new command line option is --convert-to-git-lfs, and you give it a glob expression, like *.wav, just like you do with git lfs track:

:::bash
$ java -jar ~/bfg-1.12.5.jar --convert-to-git-lfs '*.wav' --no-blob-protection

This will reduce the size of your core Git repo, while still keeping those files readily available in the secondary Git LFS store.

A full step-by-step example of doing this on the command line:

:::bash
$ git clone --mirror heavy-repo # a 'bare' repo, with all branches and tags
$ cd heavy-repo.git # Now is a good time to make a backup!

$ java -jar ~/bfg-1.12.5.jar --convert-to-git-lfs '*.wav' --no-blob-protection
# the BFG rewrites history, extracting files to lfs/objects and adding .gitattributes for LFS tracking
$ git reflog expire --expire=now --all && git gc --prune=now
$ git lfs init

# let's push everything up to your Git LFS-enabled hosting provider:
$ git remote set-url origin git@github.com:some-org/heavy-repo.git
$ git push # because you cloned using --mirror, this will push ALL branches and tags

You want to be using a least Git LFS 1.0.0 or above (which includes some recent changes to improve pushing from bare repos).

Source: README.md, updated 2015-09-04