Questions tagged [bfg-repo-cleaner]

BFG Repo-Cleaner is an alternative to Git's native filter-branch tool that's designed to perform branch filtering significantly faster.

The BFG Repo-Cleaner is an alternative to Git's native git filter-branch that's made for cleansing unwanted data (big files, passwords) out of Git repository history. It's designed to be faster and simpler to use, and is written in Scala.

The BFG Repo-Cleaner is even officially endorsed as an alternative in the official Git documentation for filter-branch itself:

git-filter-branch allows you to make complex shell-scripted rewrites of your Git history, but you probably don’t need this flexibility if you’re simply removing unwanted data like large files or passwords. For those operations you may want to consider The BFG Repo-Cleaner, a JVM-based alternative to git-filter-branch, typically at least 10-50x faster for those use-cases, and with quite different characteristics:

  • Any particular version of a file is cleaned exactly once. The BFG, unlike git-filter-branch, does not give you the opportunity to handle a file differently based on where or when it was committed within your history. This constraint gives the core performance benefit of The BFG, and is well-suited to the task of cleansing bad data - you don’t care where the bad data is, you just want it gone.

  • By default The BFG takes full advantage of multi-core machines, cleansing commit file-trees in parallel. git-filter-branch cleans commits sequentially (ie in a single-threaded manner), though it is possible to write filters that include their own parallellism, in the scripts executed against each commit.

  • The command options are much more restrictive than git-filter branch, and dedicated just to the tasks of removing unwanted data- e.g: --strip-blobs-bigger-than 1M.

See also the git-rewrite-history tag on Stack Overflow.

160 questions
1
vote
1 answer

How to delete folder from git history permanently using BFG

I am using BFG to delete two of my folders. They were tracked from the inception of the repo. The reason to delete was those folder contains binary and other txt file that we no longer need. But When I try to delete those two folder, one gets…
mato
  • 503
  • 8
  • 18
1
vote
0 answers

BFG Repo cleaner: Delete many folders with same name. Size still the same

I have a huge git repository and I want to reduce the size. To achieve that, I want to delete a folder, which exists many times in different subdirectories with the same name. The git repository has the following folder structure: - ID1 -…
caldicot
  • 195
  • 2
  • 15
1
vote
1 answer

BFG repo cleaner is not shrinking a specific repo

Is there a scenario where BFG doe not shrink a repo ? I have used BFG repo multiple times over several repos with success. Great tool ! However, for one specific repo, I am not getting any reduction at all. The strange this is that I used BFG repo…
user1554876
  • 192
  • 3
  • 19
1
vote
1 answer

BFG Repo cleaner - Moving git history of a directory from repository A to repository B

I have two repositories viz. repository A and repository B. I am moving one directory from repository A viz. dir-to-move to repository B. But I want to retain git history of that directory only ( i.e. of dir-to-move ) for which git-filter-branch is…
BND
  • 51
  • 12
1
vote
1 answer

Removing passwords from git repo without bfg

Is there any way to replace sensitive information (API keys etc) in a git repo without using BFG and without removing the file's history? BFG depends on JRE and I really don't want to t install it if there is another way. Github help pages…
charsi
  • 2,917
  • 22
  • 40
1
vote
2 answers

GIt: Removed several files from repository with BFG and there are enormous commit diffs

I recently removed several large files from a repository using BFG --delete-files , and the output appeared to be what I expected. The correct files and sizes were reported as deleted from the repo and the local size reflects these…
user8897013
  • 443
  • 4
  • 15
1
vote
1 answer

git lfs and BFS

BFG for git LFS supports the option --strip-blobs-bigger-than Does git-lfs itself support tracking files based on size, or only based on extension? The git-lfs-track man page seems to only support specifying by extension, so I'm guessing BFS just…
simpleuser
  • 1,617
  • 25
  • 36
1
vote
1 answer

Cleaning Up A Bloated Git Repo W/ BFG

My company website has a Git repo that includes some directories that contain a bunch of large binaries (PDFs, MP3s, etc.). Naturally, this has resulted in a really big repo which makes cloning it pretty impractical. There have been a large number…
ediv
  • 71
  • 1
  • 4
1
vote
2 answers

Troubleshooting getting rid of large files in a git repository on GitHub

I have a project called geoplot that does geospatial plotting in Python. The code for it is distributed via git on GitHub. You can check it out here. As a part of the development process for this package, I uploaded and stored in the geoplot repo a…
Aleksey Bilogur
  • 3,686
  • 3
  • 30
  • 57
1
vote
1 answer

Cleaning git repo of large files

I committed over 600 large(ish) jpgs to my git repo and can now see the error of my way. I have used the BFG to remove them and my local repository no longer shows them. My local git GUI doesn't show them. If I check the size of the repo in Finder…
rctneil
  • 7,016
  • 10
  • 40
  • 83
1
vote
1 answer

How to use bfg-repo-cleaner after Git rebase on non-bare repo?

Overview I have Git repo which serves as an archive for a number of configs sourced from elsewhere: 200 dirs 100 files per dir 10K plain text per file ~1000 commits per day, usually < 10 lines edited 1 branch 1 user handles all commits all other…
333kenshin
  • 1,995
  • 12
  • 17
1
vote
2 answers

Remove file from github and history

I am aware this question has been asked before but I am still confused on the exact steps that I need to take. A few months ago I committed a file which contains sensitive information in a public repository (that I own) on github. I now must remove…
boywonder
  • 116
  • 2
  • 11
1
vote
0 answers

bfg or filter-branch to correct history

I found this answer over here: Duplicate commits after filter-branch to move root directory Which is probably what I should have done originally. I had a repo like: ./.git ./project/something ./project/lots_of_stuff/ I wanted "project/" to be the…
Mr. Hasquestions
  • 168
  • 2
  • 10
1
vote
1 answer

BFG is removing sensitive content everywhere but in the penultimate commit

I was trying to remove a couple of lines from a file in my history containing a secret API token and some endpoint that are way better passed as environment variables than hardcoded there, so if I make the repo public someday they won't be there for…
Alfageme
  • 2,075
  • 1
  • 23
  • 30
1
vote
2 answers

Removing files from past commits in GitHub repository with BFG Repo-Cleaner

I have a file in my GitHub repository that I would like to remove from my previous commits. I used BFG Repo-Cleaner's delete-files command and it appeared to work, but when I go on my GitHub repository the file is still on all the previous commits.…
ecain
  • 1,282
  • 5
  • 23
  • 54