BFG: git repo-cleaner (like git-filter)

An alternative to git-filter-branch.

The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:

  • Removing Crazy Big Files
  • Removing Passwords , Credentials & other Private data
$ java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
$ java -jar bfg.jar --replace-text banned.txt repo.git
1 Like

These days git filter-branch shows a warning, recommending git filter-repo which can solve some complex scenarios.


Also git revise is an efficient alternative to git rebase for changing only history, but not files.

# Squash some fixup commits without checking out old commits.
git revise -i --autosquash @{u}

# Edit all commit messages since upstream in a single buffer.
git revise -ie @{u}

# Switch the order of the last two commits
GIT_SEQUENCE_EDITOR='kak -f gkxdp' git revise -i HEAD~2

(Actually the 0.6.0 release is mistakenly using SEQUENCE_EDITOR, but that is to be fixed in the next release).

3 Likes

So you have heard of git-filter-branch. I wonder why BFG used it in their promo? ← feel the sarcasm :joy:

Removes large or troublesome blobs like ‘git-filter-branch’ does, but faster. Written in Scala.

BountySource BFG.