How to remove a protected commit using BFG

后端 未结 4 772
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 01:02

When cleaning the repo with BFG (https://rtyley.github.io/bfg-repo-cleaner/) ,encountered the following :

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

These are your pr         


        
相关标签:
4条回答
  • 2021-02-19 01:29

    This is a very late reply, but I hit a similar problem.

    Were you trying to remove a file from a git repo and its history? Were you in a hurry and failed to notice that file is present in the state of the most recent commit, which BFG by default treats as protected? This was an error that happened between my keyboard and chair today.

    If you want to clean a repo: (1) remove the unwanted file with the usual git commands e.g., git rm file; git commit, (2) test that everything still works without that file, (3) use bfg to rewrite the repo history without that file.

    0 讨论(0)
  • 2021-02-19 01:32

    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.

    0 讨论(0)
  • 2021-02-19 01:38

    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.

    0 讨论(0)
  • 2021-02-19 01:46

    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

    0 讨论(0)
提交回复
热议问题