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

Can't get bfg-repo-cleaner work

I was trying to use BFG Repo-Cleaner to remove a large file from git history, but can't get it work. Please help! I downloaded the latest BFG bfg-1.12.12.jar Then I tried to clone a fresh copy of my repo: $ git clone --mirror…
Lucas
  • 25
  • 4
1
vote
1 answer

Replaced text with BFG, and now it shows my fork is several hundred commits ahead/behind

I recently forked a project and after a few dozen commits, noticed there was some sensitive info I wanted to remove from a file. While wanting to remove that, either by undoing only my commits for that file, and redoing changes as one, or possibly…
empedocle
  • 1,862
  • 1
  • 14
  • 25
1
vote
1 answer

How to shrink Git repo and better manage large files

I've used the BFG repo cleaner in the past with great success. I've also recently started tinkering with Git LFS, although I'm still learning. I had previously .gitignored many large files, and when I started tracking then with LFS, the .git/ folder…
rbatt
  • 4,677
  • 4
  • 23
  • 41
1
vote
1 answer

Git/Bitbucket - Remove file from entire history/commits

Following the directions for BFG I proceeded to remove a private file that should not be on the repo/commit history. https://rtyley.github.io/bfg-repo-cleaner/ I ran $ bfg --delete-files .private my-repo.git and pushed the changes however, it…
Miura-shi
  • 4,409
  • 5
  • 36
  • 55
0
votes
1 answer

Git add subtree of repo with removed LFS files

I have a few repos that I want to consolidate into a single one but maintain all git history. I am not interested in using submodules or repo tools, I just want to make a monolithic repo for this. For the example let's say the repos are named like…
ndeubert
  • 831
  • 7
  • 6
0
votes
1 answer

Can't get git filter-repo to work - No files are removed

We have a git repo that had some code we didn't want visible publicly pushed to a public repo. I am trying to use git filter-repo to remove the files from the repo. I have created a text file containing the relative paths to the files I want…
Gabe
  • 1
  • 1
0
votes
0 answers

Git tool BFG when run with filter excluding, filter does not work on other branches

java -jar bfg.jar --filter-content-excluding '*.{h,cpp,c,xml,js,json,pl,html,htm,py,csv}' --strip-blobs-bigger-than 1M --no-blob-protection .git Please help... when run with filter excluding, filter does not work on other branches... excluding…
Roman Zinger
  • 102
  • 2
  • 9
0
votes
0 answers

Is there a way to remove one file from a full git history and releases/tags?

I commited my imprint to a now big project and pushed it to github. The problem: At that time i lived with my parents. Because i don't wanted to leak my parents Adress, i made the Repo private. Now i want to make the repo public, because it should…
0
votes
1 answer

How to fix "branch is currently checked out" when trying to repair history with bfg

Problem: Accidentally commited a large file, and it wasn't the most recent commit, so now I have to dig it out of my history (because of GitHub file size limitations) in order to push my commits to GitHub. Meaning I have a local copy of my repo…
Sheldonfrith
  • 2,107
  • 2
  • 12
  • 16
0
votes
0 answers

How to delete large objects from the *remote* git repo? (BFG local changes don't persist.)

BFG works great for deleting files in a local repo. But I realized that a git push --force to GitHub does not cause the files to be deleted on GitHub as well. E.g.: I've tried doing a force push, then cloning the repo from GitHub in a temp…
Dogweather
  • 15,512
  • 17
  • 62
  • 81
0
votes
1 answer

BFG Repo cleaner - how to remove the secrets history from tags

I am following the steps from below link to remove the secrets from git history. https://rtyley.github.io/bfg-repo-cleaner/ But the history is not getting removed from the tags. Could you please help on how to remove the history from tags?
Varun
  • 85
  • 1
  • 7
0
votes
1 answer

How do you check if a file or folder (in my case) has been deleted from your git history?

I used the "BFG Repo Cleaner" to remove a folder (target) I accidentally tracked and pushed to the remote repository, and I am wondering how I can I check if the folder was indeed completely removed from the git history?
ninjarogue
  • 19
  • 2
  • 4
0
votes
1 answer

GIT LFS migration using BFG increase total repository size by 4x

We are migrating a 5GB repository from SVN to GIT SVN to GIT migration svn2git http://xxx/svn/yy --trunk trunk --nobranches --notags --username user --metadata --authors /xx/yyy/authors.txt LFS migration java -jar ../bfg-1.14.0.jar…
0
votes
1 answer

Used BFG to remove large files from repo, but missing branches

In gitlab, there were 3 branches: master, UAT and NEWCOCOAPODS. I used BFG and successfully removed 3 large files. After pushing back up to gitlab, only master is there. The output includes: remote: To create a merge request for NEWCOCOAPODS,…
Owen Hartnett
  • 5,925
  • 2
  • 19
  • 35
0
votes
1 answer

How to delete commits from before a certain point?

At some point in the past, sensitive info was uploaded to a git repo. We removed this in the following commit and changed the info, but we'd still like to remove the original info from the git history, while preserving the commits made since then if…