git-filter-repo icon indicating copy to clipboard operation
git-filter-repo copied to clipboard

Is there a way to use --to-subdirectory-filter with --refs more efficiently?

Open bushelofsilicon opened this issue 4 years ago • 1 comments

I have a csv of a bunch of branches and what folder I should move their root directory into. I loop over this and use git filter-repo like below

foreach ($branchMapping in $branchMappings){
    git filter-repo --to-subdirectory-filter $branchMapping.directory --refs refs/heads/$($branchMapping.branch)
}

For each loop I writing the Git history. Is there a way to apply these changes and then rewrite history all at once? I feel like that would be faster, (it takes a long time to do each rewrite) or is that an incorrect assumption?

I'm just thinking of host running git replace a bunch of times and then running git filter-repo is faster than running git filter-repo after each git replace.

bushelofsilicon avatar Feb 23 '21 16:02 bushelofsilicon

Are these branches completely independent, or do they share common points of history?

If they're completely independent and share no common point in history, then it's not clear why it'd be faster to do it all in one go. It's also not clear why they are all found in the same repository. Most repositories tend to have a single initial commit; I've seen some repositories with more, but it sounds unusual to me to have one for every branch.

If they do share some history (e.g. they all branched off master at some point), then why do you want the common history from e.g. master rewritten in N different ways?

newren avatar Mar 11 '21 20:03 newren

No response; closing.

newren avatar Jul 02 '24 15:07 newren