I use git filter-branch
to split a subfolder out into a new repository, refer to https://help.github.com/articles/splitting-a-subfolder-out-into-a-new-repository/ and https://stackoverflow.com/a/45983384/301513
My question is, according to the steps in the article, I need to create a new repo and git pull the-subdirectory-filter-result
into the new repo. But is it possible I can still use old repo and reclaim the git space, i.e to make the old .git only has that subdirectory related metadata? If I can, I don't need to create a new repo, after all the old one does not have much use now.
I tried the step #5 in Paul's answer at https://stackoverflow.com/a/359759/301513, but it did not work. And git gc
won't reclaim the git history for those un-related commits.