简体   繁体   中英

BFG Repo cleaner - Moving git history of a directory from repository A to repository B

I have two repositories viz. repository A and repository B. I am moving one directory from repository A viz. dir-to-move to repository B. But I want to retain git history of that directory only ( ie of dir-to-move ) for which git-filter-branch is taking huge time. So I want to use BFG Repo cleaner which is faster. But I want to reduce size of my .git folder as well. So question is two fold

  1. How do I execute following command using BFG Repo cleaner ?

git filter-branch --subdirectory-filter {dir-to-move} -- --all

  1. How to reduce .git size after running BFG Repo cleaner ?( which is right now in GB to MB )

How do I execute following command using BFG Repo cleaner ?

git filter-branch --subdirectory-filter {dir-to-move} -- --all

Answer received to the BFG issue Equivalent of git filter-branch --subdirectory-filter addresses your question:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM