51

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.

Roberto Tyley
  • 24,513
  • 11
  • 72
  • 101
SeB.Fr
  • 1,246
  • 1
  • 14
  • 16

2 Answers2

98

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.

AndreKR
  • 32,613
  • 18
  • 106
  • 168
Roberto Tyley
  • 24,513
  • 11
  • 72
  • 101
  • 22
    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? – justinbach Mar 13 '14 at 14:38
  • Sorry I didn't want to sign up for Bountysource, so I'm giving you 5 karmas instead of $5. Amazingly easy to use. – Noumenon Feb 16 '16 at 13:30
  • 1
    Are the folder names relative, absolute, wildcards, or some kind of other matching system? – fIwJlxSzApHEZIl Jul 27 '22 at 17:39
1

You can delete multiple folder using the command like this:

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

Thanks !

Marc Tarin
  • 3,109
  • 17
  • 49
Lalit Dashora
  • 467
  • 5
  • 16