18

I am trying to delete multiple types of files which cannot be covered by a wildcard. I tried using multiple --delete-files but it won't accept it. Also tried putting the files all after one --delete-files and it doesn't accept it either.

Is there a way to put them all in one command? If not, then do I have to run git reflog expire --expire=now --all && git gc --prune=now --aggressive after deleting each type of file with bfg or can I just run bfg multiple times and then run that command after?

LINUX G33NYUS
  • 621
  • 6
  • 13

2 Answers2

23

It turns out that you can use a blob surrounded in quotes like "{a*,b*conf}" for example.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
LINUX G33NYUS
  • 621
  • 6
  • 13
  • 6
    Thank you and yes indeed this worked 100% for me `java -jar bfg-1.12.15.jar --delete-files "{continue.txt,result.txt,list,hosts,*active.txt,percentage.txt,inactive.txt,invalid.txt,*.zip}" my-repo.git/` – MitchellK Sep 28 '17 at 09:47
  • 1
    awkward. if you want to add a file to an existing list like "*.{model,xmodel}" then you need to expand it to "{*.model,*.xmodel,newfilename}" – simpleuser Oct 06 '17 at 21:20
  • 1
    For those using this: do NOT put a space after each comma. – evaristegd May 21 '20 at 04:28
0

I implemented something like this a while back and created a pull request.

javabrett
  • 7,020
  • 4
  • 51
  • 73