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
0
votes
1 answer

Removing multiple newline characters from git history

I was trying to clean my repo from multiple empty lines in code (more than 4) with bfg repo cleaner. I tried various regular expressions, but didn't come up with a solution. The closest result I achieved was simply removing all new lines from a…
Vadym Sidorov
  • 85
  • 1
  • 8
0
votes
1 answer

cleaning git history with BFG

As I recently tried to push my commits to github, I got the same error message as in this question. I removed the files from my repository but now have to clean up the history. As advised in the answers I looked into BFG, which seems to be the…
fukurai
  • 104
  • 1
  • 1
  • 9
0
votes
1 answer

Cannot push after BFG Repo-Cleaner

We have a self-hosted Gitlab instance. I used BFG-Repo-Cleaner and everything went well, but when I try to push changes I get this: remote: GitLab: You are not allowed to force push code to a protected branch on this project. P.S. I'm owner of the…
CappY
  • 1,510
  • 1
  • 17
  • 32
0
votes
1 answer

Git and repo size

Ok, so I have this remote repository on bitbucket and and I didn't work with my local files for the last 6 months. Now, today, after a good amount of work, I try to commit and push my so missed code, the operation takes more than 30min and I cancel…
delmalki
  • 1,326
  • 1
  • 13
  • 31
0
votes
1 answer

Git push error while trying to push mirror to remote repository

I am trying to clean up git repository. There are some identified big files whose size is reduced and recommitted. The issue is history still has old files. So I used bfg cleaner job to prune the git repo. For this I first create a mirror clone of…
nishat
  • 947
  • 2
  • 8
  • 15
0
votes
1 answer

Possible to undo permanent deletion of file?

A colleague of mine attempted to permanently remove a file (Diff.java) from the history of our GitHub repo. He had good reasons for wanting to do this, however something seems to have gone wrong as we seem to have lost quite a few files which have…
adamretter
  • 3,885
  • 2
  • 23
  • 43
0
votes
2 answers

Permanently removing binary files from GitLab repos

We have a GitLab-hosted repo at work that contains some large binary files that we'd like to remove. I know of tools such as BFG Repo-Cleaner which will remove a file from a Git repository. We often refer to specific commit IDs in GitLab. Would…
Matt
  • 1,928
  • 24
  • 44
-1
votes
1 answer

Should I use git-filter-repo on the repo clone or on the self hosted bare repo?

There's a self hosted git repository on a Windows Server (Bonobo based if anyone interested). The repository got bloated up because of binary blobs and I'd like to strip out these large blobs along with their whole history. I was looked at bfg / git…
Csaba Toth
  • 10,021
  • 5
  • 75
  • 121
-1
votes
1 answer

Deleting a directory from git history on a specific branch

The issue: There is a folder in my GitHub repo, in a branch called 'my-branch' and it needs to be removed. It is not the last commit. Details of issue: created a branch off of master, let's call it 'my-branch'. did some work in 'my-branch'…
A K
  • 3
  • 1
-1
votes
1 answer

Deleting a file that contains some sensitive data from Git history

How can I delete appsettings.json file from Git history? I have applied this command in Git: $git filter-branch --index-filter 'git rm --cached --ignore-unmatch appsettings.json' HEAD But It does not work with this version of…
x19
  • 8,277
  • 15
  • 68
  • 126
1 2 3
10
11