在过去,我使用git filter-branch从我的git历史记录中删除文件。在此之后,我可以执行强制推送来更新远程存储库。例如,从本地回购中删除所有HTML文件,然后重写远程以反映更改:
$ git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch -r \*.html' --prune-empty -- --all
$ git push origin --force --all这个很好用。但是,由于filter-branch非常慢,并且已经被废弃了一段时间,所以我想用git-filter-repo来代替。到目前为止,这似乎是等效的命令:
$ git-filter-repo --force --path-glob *.html --invert-paths这第一步似乎奏效了。我的问题是,当我试图推动后,我看到我的遥控器丢失了。
$ git push origin --force --all
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.当我检查git remote -v时,filter-repo命令似乎删除了我的远程URL。手动添加遥控器让我进入兔子洞的其他设置是无效的。
为什么git-filter-repo 要移除我的遥控器?我怎样才能像用git-filter-repo git filter-branch**?**那样用重写远程的历史
发布于 2021-02-25 23:56:03
为什么git-filter-repo要移除我的遥控器?
--mirror选项推送到他们的新家,而不会意外地发送远程跟踪分支。我怎样才能像用git过滤器分支重写远程的历史一样,使用git-filter-repo呢?
只需使用git remote add将origin放回,或者-因为命令序列中的步骤3是git remote rm origin-just将origin重命名为其他名称。但是,如果您这样做,请注意步骤2。
你说过:
手动添加遥控器让我进入兔子洞的其他设置是无效的。
很明显,你需要在这里讲得更详细些。
发布于 2021-12-02 20:06:43
最近在做git。同样的问题。
运行git-filter-repo之后,我的"git分支-r“将什么也不返回。要返回输出,您需要:
git remote add origin xxxxxxxxxxx
git fetch --all然后,您将获得"git分支-r“输出。
https://stackoverflow.com/questions/66373656
复制相似问题