MyGit

v1.12.5

rtyley/bfg-repo-cleaner

版本发布时间: 2015-10-02 06:41:36

rtyley/bfg-repo-cleaner最新发布版本:v1.14.0(2021-02-28 00:46:21)

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 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).

相关地址:原始地址 下载(tar) 下载(zip)

查看:2015-10-02发行的版本