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
7
votes
2 answers

git notes after BFG?

I migrated from SVN to git and i had a note in each git commit referencing to SVN revision number. After repo import i used BFG repo cleaner to clean git history from binary files and other trash. Unfortunately now i do not see notes when i type…
Kirill
  • 6,762
  • 4
  • 51
  • 81
7
votes
2 answers

BFG Repo Cleaner is not working as expected

I am trying to reduce the size of a largish repo (~3.4 G) and bfg-repo-cleaner seemed like a perfect tool to to reduce the size of it. I ran the tool as described in the docs but am only seeing minor reductions in the size of the repo. What is…
Zachary Cicala
  • 151
  • 1
  • 5
6
votes
1 answer

Cleaning git repository BFG Repo-Cleaner --- repo size is still large after I push

I am trying to clean up my git repository with BFG repo cleaner. So I did: git clone --mirror https://github.com/FourierFlows/FourierFlows.jl.git used BFG, e.g., java -jar bfg-1.13.0.jar --delete-files 'twodturb*.png' FourierFlows.jl.git and…
navidcy
  • 61
  • 1
  • 3
6
votes
1 answer

How to find the git object id of an object with a known hash

I am using bfg to clean my git repo. To get the list of big files to delete, I use this script. However for some files I only want to delete specific versions of them from the repo. bfg has the option to "strip blobs with the specified Git object…
Chin
  • 19,717
  • 37
  • 107
  • 164
6
votes
1 answer

can bfg-repo-cleaner list affected files before deleting them

From the command line option I can not see that there is a way to see what bfg will do before doing it. If I run this command: $ bfg --strip-blobs-bigger-than 1M --replace-text banned.txt repo.git Can I get a list of files larger than 1M before…
Martin Andersen
  • 2,460
  • 2
  • 38
  • 66
6
votes
2 answers

Am I supposed to run BFG on the mirrored repo or the original?

I want to delete two files from my git repo that aren't there anymore. I put them in, committed, and tried to push but they were too large. So I took them out, and kept working, then committed, tried to push, but it still gave me the same error. I…
user4084811
6
votes
1 answer

Need to clone repo after using bfg repo-cleaner or pull on existing?

Reading the instructions for bfg repo-cleaner, the work flow seems like: clone the repo using the --mirror option strip the repo from unwanted items using bfg use git gc to physically remove the items do a push of the cleaned repo However, then it…
halcwb
  • 1,480
  • 1
  • 13
  • 26
5
votes
1 answer

What happens to other branches when I use BFG Repo-Cleaner on master

I'm trying to use this tool to shrink my .git folder size which is 3.1GB right now. Code is under 100MB. This repo is very old and has many branches ~250. If I use this tool on master branch, what will happen to other branches? It mentions: By…
Shinebayar G
  • 4,624
  • 4
  • 18
  • 29
5
votes
1 answer

How to fix "bfg: command not found" in git-bash

I am trying to use BFG Repo Cleaner to replace some text in one of my git repos. I have downloaded and installed the jar file, but when I try to run the bfg command I get error "bfg: command not found". When I run the bfg.jar file it seems to work…
Heather Frank
  • 135
  • 3
  • 8
5
votes
3 answers

How to verify that BFG Repo-Cleaner has correctly removed a large file from a git repository?

I have used the BFG Repo-Cleaner to remove a large file from a git repository: java -jar ../bfg-1.11.8.jar --delete-folders escrow application.git cd application.git git reflog expire --expire=now --all git gc --prune=now --aggressive cd .. mkdir…
5
votes
4 answers

Inspect git repo after using BFG repo-cleaner

Very basic git question: I uploaded some compromising information to Github and am using bfg to clean the repo. I followed the documentation and performed the following actions: $ git clone --mirror git://example.com/some-big-repo.git $ bfg…
4
votes
0 answers

BFG - Is there any way to replace text on files on a specific path?

I'm using BFG to cleanup a repository removing some sensitive data from files. The command I'm running looks like this: java -jar bfg --replace-text passwords.txt -fi '*.config' repo.git The issue is that the repository has several .config files…
Felipe Correa
  • 654
  • 9
  • 23
4
votes
1 answer

Bfg-repo-cleaner tool successful but repo size not decreased

I have a repository in my bitbucket server, for which the .git folder was 660 MB and the total size of the repository was 714 MB. I used the bfg-repo-cleaner tool on the repository, and using git count-objects, saw that the size reduced to 125 MB.…
Vibhuti
  • 41
  • 3
4
votes
1 answer

Git: Remove everything except for a certain directory (BFG Repo Cleaner)

I am trying to permanently remove all traces of all directories in a Git repository except for one directory, say named keep-me. For such tasks, the BFG repo cleaner is my usual go-to tool. However, it does not seem to support this operation (in…
SuperUser
  • 157
  • 1
  • 7
4
votes
0 answers

Git repo size increased post BFG Repo Cleaner use

I have cleaned my repo with BFG Repo Cleaner $ git clone --mirror ssh://git@example.com/some-big-repo.git $ java -jar bfg-1.12.8.jar --strip-blobs-bigger-than 100M some-big-repo.git Output from above command: SLF4J: Failed to load class…
nishat
  • 947
  • 2
  • 8
  • 15
1
2
3
10 11