How to remove a protected commit using BFG

坚强是说给别人听的谎言 提交于 2019-12-04 03:42:41

Running BFG with: --no-blob-protection fixed it for me.

The docs are here: https://rtyley.github.io/bfg-repo-cleaner/, but I didn't see where they really call that out as a means to move past the error.

Note: In my case I had already tried to remove files manually, not using BFG, which got me in a state where I had to use --no-blob-protection.

If you're going to use a tool as powerful as BFG, I'd strongly advise you to read its documentation (which spells this out), but to answer your question:

BFG by default leaves "current" commits unchanged. Its author believes the only safe workflow is to clean up your repo's current state manually, test that everything still works, then use BFG to clean up history while leaving the current-state (which you already fixed manually) alone.

There are options available to change the protection from default (or turn it off) if you have use cases where you think it's unnecessary (as I have more often than not); but if you want to use those, you definitely need to read the docs.

First What is BFG? The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history: * Removing Crazy Big Files * Removing Passwords, Credentials & other Private data.

Suppose,You have made some mistakes in the past, but now you've cleaned up your act. Thus the BFG assumes that your latest commit is a good one, with none of the dirty files you want removing from your history still in it. This assumption by the BFG protects your work, and gives you peace of mind knowing that the BFG is only changing your repo history, not interfere with the current files of your project. By default the HEAD branch is protected, and while its history will be cleaned, the very latest commit (the 'tip') is a protected commit and its file-hierarchy won't be changed at all.

For more study you can refer this link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!