即,我有:
root -- c1 -- c2 -- .. - c1000 -- c1001 -- c1002 -- .. -- c2000 -- top
我想拥有:
root = c1000 -- c1001 -- c1002 -- .. -- c2000 -- top
如何?
(我想我可以通过 git filter-branch
来做,但具体怎么做呢?)
(我当然知道这是改写历史的意思……)
最佳答案
我发现以下内容对于创建具有不同根目录的新存储库很有用(当您说在提交前删除历史记录时,我认为您会问这个问题):
git fast-export master~5..master | (cd ../newrepo.git && git init . && git fast-import && git checkout)
(您也可以在同一个仓库中执行上述操作)
关于Git:如何在特定提交之前删除历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7459209/