【发布时间】:2018-03-14 04:04:43
【问题描述】:
我使用git filter-branch 将一个子文件夹拆分到一个新的存储库中,参考https://help.github.com/articles/splitting-a-subfolder-out-into-a-new-repository/ 和https://stackoverflow.com/a/45983384/301513
我的问题是,根据文章中的步骤,我需要创建一个新的 repo 和 git pull the-subdirectory-filter-result 到新的 repo 中。但是有没有可能我仍然可以使用旧的 repo 并回收 git 空间,即让旧的 .git 只有那个子目录相关的元数据?如果可以的话,我不需要创建一个新的 repo,毕竟旧的 repo 现在没有太多用处了。
我在https://stackoverflow.com/a/359759/301513 尝试了 Paul 的回答中的第 5 步,但没有奏效。并且git gc 不会为那些不相关的提交回收 git 历史记录。
【问题讨论】:
标签: git git-subtree git-filter-branch git-rewrite-history