How to delete folders except some folders?
My command is
java -jar ../BFG_Repo-Cleaner/bfg-1.13.0.jar --delete-folders "!(folder1|folder2|folder3)"
I want all folders except folder1, folder2 and folder3.
There is no workaround for this with BFG, you'll have to explicitly mention all the folders you want to delete from history.
Example - java -jar ../BFG_Repo-Cleaner/bfg-1.13.0.jar --delete-folders "{Folder1,Folder2,Folder3}" YourApp.git
NOTE: Make sure you have different names for different folder, as BFG doesn't care about the path it will delete the folders with the associated name.
--delete-folders delete folders with the specified names (eg '.svn', '*-tmp' - matches on folder name, not path within repo)