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

BFG remove multiple folders

I found that BFG is much faster than the original git-filter-branch. We have multiple svn repo to move to even more git repositories, this implies some repository folder merges and splits. During the process I need to remove a set of root folders…
SeB.Fr
  • 1,246
  • 1
  • 14
  • 16
48
votes
7 answers

How to substitute text from files in git history?

I've always used an interface based git client (smartGit) and thus don't have much experience with the git console. However, I now face the need to substitute a string in all .txt files from history (so, not erasing the whole file but just…
Tom
  • 8,536
  • 31
  • 133
  • 232
34
votes
3 answers

How to remove a protected commit using BFG

When cleaning the repo with BFG (https://rtyley.github.io/bfg-repo-cleaner/) ,encountered the following : Protected commits ----------------- These are your protected commits, and so their contents will NOT be altered: * commit *******…
rcde0
  • 4,192
  • 3
  • 21
  • 31
20
votes
4 answers

BFG Repo-Cleaner states my github repo is not a valid Git repository

This is a follow-up question from a previous question on Stackoverflow. I've tried to remove large files from my local git history, but the tool (BFG Repo-Cleaner) suggested in this question states that my private GitHub repository is not a valid…
boolean.is.null
  • 831
  • 2
  • 12
  • 19
18
votes
2 answers

Can multiple files be specified when using BFG?

I am trying to delete multiple types of files which cannot be covered by a wildcard. I tried using multiple --delete-files but it won't accept it. Also tried putting the files all after one --delete-files and it doesn't accept it either. Is there a…
LINUX G33NYUS
  • 621
  • 6
  • 13
14
votes
3 answers

How to update/shrink the size of my github repo after running BFG Repo Cleaner

I have cleaned my repo with BFG Repo Cleaner using the following procedure: $ git clone --mirror git://example.com/some-big-repo.git $ java -jar bfg.jar --strip-biggest-blobs 500 some-big-repo.git $ cd some-big-repo.git $ git reflog expire…
PussInBoots
  • 11,028
  • 9
  • 52
  • 84
13
votes
5 answers

Reset all branches of a local repo to be the same as remote

First this is different because this is for all branches not one. (All the ones I have found only specify this for a single branch at a time) I work on a repo that has about 20-30 branches (long story bad practice I know I know) anyways I was…
dtracers
  • 1,534
  • 3
  • 17
  • 37
13
votes
1 answer

How to delete one folder / directory using BFG repo cleaner?

How do I delete only one directory using BFG? The help says: delete folders with the specified names (eg '.svn', '*-tmp' - matches on folder name, not path within repo) Which seems to mean that --delete-folders "config" will match all folders named…
rm.rf.etc
  • 884
  • 2
  • 8
  • 20
12
votes
4 answers

How to use .jar tool BFG Repo Cleaner and reduce git repository?

I have a question that I am sure is very simple but which I can't find the answer for. I am an animator working on the Unreal Engine 4 and using Source Control, Bitbucket and Source Tree to collaborate on a current project. My coding expertise draws…
user3389654
  • 141
  • 2
  • 5
11
votes
1 answer

BFG Repo Cleaner – Alternative to Fresh Clone

I was going to ask this on the repository but SO seemed like a more fitting place to ask this. I was able to use BFG Repo Cleaner (great tool, thank you!) to reduce our .git folder size by over 1GB, which is a smashing success as far as our…
metc500
  • 113
  • 4
10
votes
3 answers

Bitbucket is alarming that my git repo is too large but I cannot confirm large files

Bitbucket is alarming that my Git repository is over 1 GB. Actually, in Repository details page it says it is 1.7 GB. That's crazy. I must have included large data files in the version control. My local repository is in fact 10 GB, which means that…
Kouichi C. Nakamura
  • 850
  • 3
  • 10
  • 25
10
votes
1 answer

Git Merge Duplication after Ineffective BFG Use

I have somehow deeply borked by entire repository (used only by me) and could use some assistance in sorting it out. Here is what I did. I realized that in my commit history, there were some files containing credentials that I did not want just…
9
votes
1 answer

Git: Delete a specific file using bfg (beg-repo-cleaner)

I am trying to delete a file permanently from the Git history, because it contains sensitive data. To do this, I am using bfg: https://rtyley.github.io/bfg-repo-cleaner/ The file is called app/config.json. However there are other files called…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
8
votes
1 answer

Git BFG to retroactively enable LFS - protected commits issue

I have large files and was attempting to use the new Git LFS system. I posted this question - Git lfs - "this exceeds GitHub's file size limit of 100.00 MB" Edward Thomson correctly identified my issue - you cannot use LFS retroactively. He…
LearningSlowly
  • 8,641
  • 19
  • 55
  • 78
7
votes
1 answer

Warning : no large blobs matching criteria found in packfiles - does the repo need to be packed?

When running bfg I see: Warning : no large blobs matching criteria found in packfiles - does the repo need to be packed? How would I go about packing the repo?
Tom Hale
  • 40,825
  • 36
  • 187
  • 242
1
2 3
10 11