git 过滤器分支错误 : "fatal: Not a valid object name HEAD"

标签 git git-filter-branch

我正在尝试使用 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/

相关文章:

windows - 在 Windows 上使用 ssh 进行 Git 连接

git filter-branch 只改变受影响的提交

python-3.x - Git 子模块 : git@github. com : Permission denied (publickey). 致命:无法从远程存储库读取

git 无法解决 rebase 冲突,因为 mergetool 没有 pop

带有可选参数的 git 别名

Git - 从分支历史记录中删除文件

git重复父项导致一半历史记录消失

git - 从 Git 存储库中拆分子目录并保留子目录中所有文件的历史_now_

git - 重写 git 历史记录以扁平化 merge 提交

git bundle 验证崩溃