How to delete one folder / directory using BFG repo cleaner?

How do I delete only one directory using BFG?

The help says:

  • Git: Remove everything except for a certain directory (BFG Repo Cleaner)
  • How to update/shrink the size of my github repo after running BFG Repo Cleaner
  • Git BFG to retroactively enable LFS - protected commits issue
  • Removing files from past commits in GitHub repository with BFG Repo-Cleaner
  • Git repo size increased post BFG Repo Cleaner use
  • git svn fetch gives “Invalid revision range” “error: 128” after bfg cleanup
  • delete folders with the specified names (eg '.svn', '*-tmp' - matches on folder name, not path within repo)

    Which seems to mean that --delete-folders "config" will match all folders named config, anywhere in the repository.

  • How do I fetch/pull multiple branches matching a wildcard string?
  • what is the meaning and difference PVCS version - SVN revision - GIT sha value
  • Target location for project “ ” already exists, can not move project
  • git fatal: repository not found remote access for Internal TFS server
  • git: ignore source in production branch and minified files in development
  • Integrating Git Slave With Jenkins
  • One Solution collect form web for “How to delete one folder / directory using BFG repo cleaner?”

    I found the answer here: remove files from specific path

    The author of BFG says it can’t be done, unless you use a special command to dump all blobs for a given directory to a text file, and then use –strip-blobs-with-ids and provide that text file.

    This doesn’t work for me. I run the command:

    git log --format=%H -- cms/assets/ | xargs -IcommitId git rev-parse commitId:cms/assets/

    I get a list of 8 blob ids. I put those in text file, then I exec bfg -bi ~/tmp/blob-ids, and BFG exits saying: BFG aborting: No refs to update - no dirty commits found??

    Git Baby is a git and github fan, let's start git clone.