Use BFG to delete large/unwanted files from GIT history

Use BFG to delete large/unwanted files from GIT history

REF: https://rtyley.github.io/bfg-repo-cleaner/

STEP

0 - Download bfg.jar

http://repo1.maven.org/maven2/com/madgag/bfg/1.13.0/bfg-1.13.0.jar

1 - clone existing REPO

$ cd  ~/wy/codes/walmart/dc_realignment/
$ mkdir tmp
$ cd tmp
$ git clone --mirror ../dc_realignment/
# dc_realignment.git/ will be created under tmp/

2 - run bfg.jar to clean large/unwanted files (model.lp + model.mps)

# Put downloaded bfg.jar under tmp/
$ java -jar  bfg-1.13.0.jar  --delete-files '*.{lp,mps}'  dc_realignment.git

$ gitlog  # to confirm

3 - clean-up

$ cd dc_realignment.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive 

4 - push back to mirror source

# need to git checkout to a different branch on the source
$ git push

5 - switch back to source and push to remote

$ cd  ~/wy/codes/walmart/dc_realignment/dc_realignment/
$ git push origin --force
Table of Contents