2

I have a file in my GitHub repository, that I would like to remove/rewrite all history related to the file. so i have taken all commits related to the commits kept it in one file. Trying to use BFG approach. since my requirement is want to rewrite the git-history without touching the code.

I am getting this error when i try to use BFG with this commands

-bi, --strip-blobs-with-ids <blob-ids-file>

bfg --strip-blobs-with-ids blobs.txt.  user/dam.git --no-blob-protection

Protected commits
-----------------

You're not protecting any commits, which means the BFG will modify the contents of even *current* commits.

This isn't recommended - ideally, if your current commits are dirty, you should fix up your working copy and commit that, check that your build still works, and only then run the BFG to clean up your history.

Cleaning
--------

Found 2289 commits
Cleaning commits:       100% (2289/2289)
Cleaning commits completed in 503 ms.

BFG aborting: No refs to update - no dirty commits found??
Stefan Steinegger
  • 63,782
  • 15
  • 129
  • 193
Ravinder
  • 21
  • 1
  • 2

1 Answers1

2

That error came because BFG couldn't find the Git Object ID(s) mentioned in the blobs.txt file.

Please ensure that you were using Object ID not the SHA-1 hashes of the blob's contents. You can get the Object ID on any file by using this command -

$ git hash-object README.md
a63b49c2e93788cd71c81015818307c7b70963bf

BFG also offers different commands to remove files/folders from the history.

$ bfg --delete-files id_{dsa,rsa}  my-repo.git

$ bfg --delete-folders {FolderName1, FolderName2}  --no-blob-protection  my-repo.git
Vinay sharma
  • 745
  • 5
  • 14