我正在尝试使用 git filter-branch 命令将两个子文件夹移动到它自己的存储库中。我尝试运行下面的命令并导致 fatal error
git filter-branch --prune-empty --subdirectory-filter "adb-*" -- master
错误:
Rewrite 52d9bf5425d940f730ccdad1548b7d957936cd00 (59/59) (55 seconds passed, remaining 0 predicted)
Ref 'refs/heads/master' was deleted
fatal: Not a valid object name HEAD
有人可以告诉我我可能缺少什么吗?
最佳答案
Is there a way to include multiple sub-folders
您可以使用
bfg-repo-cleaner
:https://rtyley.github.io/bfg-repo-cleaner/反而。例如:
# Delete all files named 'id_rsa' or 'id_dsa' :
$ bfg --delete-files id_{dsa,rsa} my-repo.git
我偶尔使用它,但在文件夹上尝试过。
每当我需要删除文件夹时,我都会使用
git subtree split
这不是优化的解决方案,但可以完成工作。
关于git 过滤器分支错误 : "fatal: Not a valid object name HEAD",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56431657/