Skip to content

The BFG Repo Cleaner

Randy McDermott edited this page Aug 24, 2016 · 26 revisions

There are generally two reasons why you might need to "clean" your repo:

  • The repo has grown too large

  • Someone committed sensitive information

The Git functionality to handle these problems is the utility called git-filter-branch. However, unless you are a real expert with Git, git-filter-branch is pretty difficult to use. Thankfully, there is an amazing alternative called The BFG Repo-Cleaner by Roberto Tyley.

To use BFG you need to have command-line Java installed. Download and install JDK for your platform. To test your installation, open a terminal and type

$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Once Java has successfully installed, move on to installing (really just downloading) The BFG Repo-Cleaner. In the link provided, the download button is at the upper-right. Move the bfg-1.12.13.jar (or whatever the current version is) file to where ever you keep your program files (e.g., /Applications on OSX). Next, it is convenient to create an alias to the run command in your .bash_profile or .bashrc. For example, add the following line for OSX:

alias bfg="java -jar /Applications/bfg-1.12.13.jar"
Clone this wiki locally