Git:将子目录移动到新的仓库后清理提交

时间:2016-11-21 09:25:14

标签: git

我最初有一个大型回购,我已经通过执行以下操作分解成了几个更易于管理的回购:

git checkout my_branch
git filter-branch --prune-empty --subdirectory-filter my_subdir my_branch
git merge --strategy=ours master    # keep the content of this branch, but record a merge
git checkout master
git merge my_branch             # fast-forward master up to the merge

这成功地保留了所有提交历史记录,但由于大型仓库很大,我的新仓库的提交历史记录很大,即使其中一些只包含少量文件。一个repo有814个提交,但只有最后5个提交仍然存在于repo中。

有没有告诉git我不再需要其他809提交了?

0 个答案:

没有答案