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
0 answers

! [remote rejected] after deleteing big blob

I wish to remove an old big blob from my repo history so I did the following: git clone --mirror git@gitlab.com:$USER/my-repo cd my-repo.git java -jar $HOME/bin/bfg-1.14.0.jar --delete-files big-file.tar.gz git reflog expire --expire=now --all &&…
lrkwz
  • 6,105
  • 3
  • 36
  • 59
1
vote
0 answers

My gitlab repo size is still more than 2 GB even though the local cloned repository is just 150 MB

My GitLab repo size was too large so I decided to reduce its size using BFG. I managed to bring it down from 3.8 GB to 2.7 GB by basically removing all folders and only letting scripts (.py files that were not in any folder) remain. I even ran…
user15155006
1
vote
1 answer

BFG duplicated my previous commits along with "clean" commits

I was trying to remove some files/folders that were accidentally uploaded to my remote git repository via BFG, and after following a guide, I seem to have duplicated commits -- one set of branches that are purged of the data, and one set that still…
mmcguffi
  • 55
  • 6
1
vote
0 answers

How can I remove dead/large files from a git repo while preserving specific branches and maintaining replace-refs?

I have a large (~2GB), old (15+ years) git repo (that's been converted from CVS to SVN to git over those years). We are changing our hosting from on-prem to cloud, so I want to take this time to clean up the repo. I want to delete old files that are…
wolfcastle
  • 5,850
  • 3
  • 33
  • 46
1
vote
1 answer

Storing results of BFG to new project in Gitlab

I've successfully (I think!) removed large files from a gitlab project mirrored on my local drive using BFG. I don't want to replace the existing gitlab project (for safety reasons), but instead want to push to a new test gitlab project. Here's…
Owen Hartnett
  • 5,925
  • 2
  • 19
  • 35
1
vote
0 answers

Not able to clear git history in Remote by BFG Repo Cleaner

I tried to delete one file from git history. I am able to delete that file from local and did the forsce push for all branches my cli are: java -jar bfg-1.13.1.jar --delete-files "{config.js}" --no-blob-protection my-repo.git git reflog expire…
jiz
  • 308
  • 3
  • 7
1
vote
3 answers

Rejected refs in repo-cleaning

I am cleaning a git repository's pull requests (PR). There was one PR created to merge a branch B, which was later considered deprecated and removed before being merged. As a result, branch B was deleted, and this PR is not showing up in Bitbucket's…
Ken S
  • 315
  • 1
  • 3
  • 11
1
vote
1 answer

BFG-repo-cleaner and pushing back to GitHub

I'm trying to follow the tutorial instructions here : https://rtyley.github.io/bfg-repo-cleaner/ I clone a new copy of my github based repo with --mirror I follow the instructions for running bgf and reflog My local repository has now removed the…
interstar
  • 26,048
  • 36
  • 112
  • 180
1
vote
2 answers

Split Git Repository and only keep history of remaining files

I got a git repository containing 11 different and independent projects (don't ask me why the **** they are all in one repository). Because some of the projects containing many assets, gitlab says that the size of the repo is about 14.3 GB and that…
D. Weber
  • 503
  • 5
  • 21
1
vote
1 answer

Replace License header in History with BFG

Is there a way to replace the license header in Git history using BFG: In my code I have this header in Java files: /* * MyCompany, Platform for Something Good * Copyright 2019-present, MyCompany, and individual contributors * as indicated by the…
quarks
  • 33,478
  • 73
  • 290
  • 513
1
vote
2 answers

Deleting folders from git history to reduce repo size

I'm trying to solve a repository size limit issue on a repository hosted on Bitbucket, where I have reached the 2GB repository size and can no longer push new commits into. At one point in time, this repository became very big due to the nature of…
1
vote
1 answer

Removing big files from Git history

I've read multiple answers advising on using either filter-branch or BFG to accomplish this task, but I feel I need further advice because my situation is a bit peculiar. I have to manage two repositories, one is basically a clone of the other, and…
1
vote
3 answers

How clean git repository with commit which not in work tree

I cleaned the Git repository (Bitbucket cloud) with bfg, but the last commit remained uncleaned (as written in the bfg documentation: By default the BFG doesn't modify the contents of your latest commit on your master (or 'HEAD') branch, even though…
ConorHolt
  • 281
  • 5
  • 17
1
vote
2 answers

Git repo history cleanup - tried BFG step by step - but the PR having lot more diffs - and how to check if password removed from history

I am trying to remove the password(s) from my Git repo history (I removed passwords from my Git repo long time back manually but not from history, and this time trying to clean throughout the history of my Git repo) And for same, started with…
1
vote
2 answers

Bitbucket reduce repo size with BFG

My team's repo on Bitbucket was 1.34GB due to some static assets (videos, images) I've followed instructions from BFG Repo Cleaner and my repo is now 2.37GB which is over our 2GB quota and it is now read only. The commands I've run were pretty much…
andrevenancio
  • 494
  • 4
  • 19