rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
10.95k stars 540 forks source link

Equivalent of git filter-branch --subdirectory-filter #303

Closed mloskot closed 5 years ago

mloskot commented 5 years ago

I have been trying to find BFG command and combination of options which is equivalent to --subdirectory-filter, for example:

git filter-branch --prune-empty --subdirectory-filter vendor/

There is similar question on StackOverflow, Moving git history of a directory from repository A to repository B, unfortunately without any answer.

There are also BFG issues which I'd connect to my question:

However, the findings seem inconclusive to me, so I decided to ask question with hope to clarify the issue.

javabrett commented 5 years ago

There is no such feature in BFG - you would have to add one yourself if you needed this.

The main barrier is - the way BFG currently works, it is unconcerned with specific paths of blobs in the repo. It just visits all commits, then recursively processes each commit's trees and subtrees. As it does so it does not keep any track of the "directory" position of the current subtree it is processing, so there's no support for any features which work with full paths.

mloskot commented 5 years ago

Thanks for clarifying that.