Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
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:
$ 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:
$ 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 firstname.lastname@example.org: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).