使用git filter-branch拆分repo:如何从重命名/移动的文件中恢复历史记录?

use*_*973 5 svn git history git-filter-branch

免责声明:我已经看到Detach(move)子目录进入单独的Git存储库,但它没有完全回答这个问题.

我已经将一个项目从svn迁移到git.当它存在于svn中时,一些文件被移动和/或重命名.

在git迁移之后,一些提交只能在 git log --follow

所以:

git结构如下:

MyMainRepo/
.git/
XYZ/
ABC/myFile.txt
Run Code Online (Sandbox Code Playgroud)

git log ABC/myFile.txt show: - commit1 - commit2

git log --follow ABC/myFile.txt 显示: - commit1 - commit2 - commit3(那时ABC目录不存在)...

现在,当拆分git repo以获得一个独特的ABC git repo时: git log --follow ABC/myFile.txt现在丢失了旧的历史记录,我只是:

  • commit1
  • commit2

我想要的是什么:

  • 从MyMainRepo拆分ABC,
  • 不要失去历史

欢迎任何帮助:)

Mat*_*ugh 0

您可能需要一个具有与日志评估类似的配方的索引过滤器,而不是子目录过滤器来跟踪历史记录中的重命名。我在这里有一个索引过滤器的工作示例,以及如何使用它的文档