BFG remove multiple folders


Solution 1

The argument to --delete-folders is a glob expression, so you should be able to just comma-separate the folder names, like this:

$ bfg --delete-folders "{folderA,folderB,folderC}" my-repo.git

Good luck!

Full disclosure: I'm the author of the BFG Repo-Cleaner.

Solution 2

You can delete multiple folder using the command like this:

$ bfg --delete-folders "{List of folder separated by comma}" git-repo.git

Thanks !


Related videos on Youtube

Author by


Updated on July 04, 2022


  • SeB.Fr
    SeB.Fr almost 2 years

    I found that BFG is much faster than the original git-filter-branch.

    We have multiple svn repo to move to even more git repositories, this implies some repository folder merges and splits. During the process I need to remove a set of root folders and I'd like to remove those to the whole history.

    I tried to use the BFG --delete-folders and it works fine for one single folder but I did not find a way to delete multiple folders. Is it even possible ? or shall I loop to call BFG as many times as I have folders to remove ?

    Thanks for any help.

  • justinbach
    justinbach about 10 years
    BFG is great! Is it possible to remove one instance of a folder with a given name in a repo if there are multiples? E.g. Given /config vs /some/other/path/config, removing the former from history without the latter?
  • Noumenon
    Noumenon about 8 years
    Sorry I didn't want to sign up for Bountysource, so I'm giving you 5 karmas instead of $5. Amazingly easy to use.