Bfg-repo-cleaner: Removing protected commit files that bfg does not delete

Created on 9 Jun 2017  路  3Comments  路  Source: rtyley/bfg-repo-cleaner

I used bfg to remove all files above 100 MB so that I can push the repository to github.
The bfg does not delete what it sees as protected commit. I have searched the web but so far I have not been able to find the specific commands.

What specific git or bfg commands can I use to completely delete unwanted large files in the protected commits? The bfg provides general guidelines but I if anyone has done this, I appreciate the sequence of commands.

The bfg prints this on the screen:

Protected commits

These are your protected commits, and so their contents will NOT be altered:

  • commit 0afd3c44 (protected by 'HEAD') - contains 7 dirty files :

    • dr/content/DRDirectSale.csv (124.9 MB)

    • dr/content/DRRebatePaymentSale.csv (127.8 MB)

    • ...

      WARNING: The dirty content above may be removed from other commits, but as

      the protected commits still use it, it will STILL exist in your repository.

      Details of protected dirty content have been recorded here :

      /home/user/repo.git.bfg-report/2017-06-08/15-07-17/protected-dirt/

If you really want this content gone, make a manual commit that removes it,
and then run the BFG on a fresh copy of your repo.

Also bfg produces a "protected dirt" csv report in this format and I am not sure how to use this information:

7921ddd4ffebb65c3fe5b2df3467e4d42f1b08b2,DELETE,regular-file,dr/content/DRDirectSale.csv,131000000,

8454bc16e6dd0133005b2618d92c09a665fb7851,DELETE,regular-file,dr/content/DRRebatePaymentSale.csv,134000000,

Most helpful comment

@javabrett thanks for the reminder. I will close this question.
By the way, this is a great utility and the speed on the large repositories that we intend to transfer from gerrit to github is very fast.

For the benefit of those folks who may run into this same issue, this is what I did to accomplish the deletion.

1) Get a "mirror" of the git repository and use bfg utility to remove all file over 100 MB

2) Look at the comma separated /home/user/repo.git.bfg-report/2017-06-08/15-07-17/protected-dirt/ file that bfg creates to find the full path to those large files that bfg did not remove.

3) get a "clone" of the repository with workspace and remove all the files using "git rm" command and commit the delete.

4) Run the bfg utility in this "clone" repository". Now bfg will delete the files.

All 3 comments

For general usage questions you might be better to close this and ask on StackOverflow with tags bfg-repo-cleaner and git-rewrite-history.

@javabrett thanks for the reminder. I will close this question.
By the way, this is a great utility and the speed on the large repositories that we intend to transfer from gerrit to github is very fast.

For the benefit of those folks who may run into this same issue, this is what I did to accomplish the deletion.

1) Get a "mirror" of the git repository and use bfg utility to remove all file over 100 MB

2) Look at the comma separated /home/user/repo.git.bfg-report/2017-06-08/15-07-17/protected-dirt/ file that bfg creates to find the full path to those large files that bfg did not remove.

3) get a "clone" of the repository with workspace and remove all the files using "git rm" command and commit the delete.

4) Run the bfg utility in this "clone" repository". Now bfg will delete the files.

@stalebbeik Thanks for the summary! Do I need to remove the files (step 3) in every branch?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

A-to-A picture A-to-A  路  4Comments

jtheletter picture jtheletter  路  5Comments

esend7881 picture esend7881  路  6Comments

TharosTheDragon picture TharosTheDragon  路  5Comments

dpopiashvili picture dpopiashvili  路  5Comments