git - 删除远程后,它的分支仍然被报告

git - After removing a remote, its branches are still reported

I 运行 git remote remove origin;,之后,git log --all --decorate; 显示了 origin 的几个 b运行ches,例如 origin/masterorigin/devel,等等

这些不是本地b运行ches。

我用过 git remote prune origingit remote update --prune,但没有任何变化。第一个命令修剪本地跟踪 b运行ches,所以我不希望它有帮助。第二个命令说 "prune all the remotes that are updated.",而 origin 实际上并没有更新;也许这就是它不修剪该回购协议的原因?

如何让 git 完全忘记这个存储库?

要查看遥控器的状态,请使用 git remote -v 命令。它会产生类似的东西:

$ git remote -v
bakkdoor  https://github.com/bakkdoor/grit (fetch)
bakkdoor  https://github.com/bakkdoor/grit (push)
cho45     https://github.com/cho45/grit (fetch)
cho45     https://github.com/cho45/grit (push)
origin    git@github.com:mojombo/grit.git (fetch)
origin    git@github.com:mojombo/grit.git (push)

假设您想删除 REMOTE cho45 存储库,请执行以下操作:

$ git remote rm cho45

然后确认:

$ git remote -v
bakkdoor  https://github.com/bakkdoor/grit (fetch)
bakkdoor  https://github.com/bakkdoor/grit (push)
origin    git@github.com:mojombo/grit.git (fetch)
origin    git@github.com:mojombo/grit.git (push)

如果您希望本地 git 忘记远程存储库,则可以使用以下过程。但是,它会为那个 repo 干杯,确定你想要那个。

cd cho45/.git
rm -rf origin
cd refs/remotes
rm -rf origin

我不确定如何使用 git 客户端执行此操作,但也许您想要的是

cd .git;
rm -rf origin;
cd refs/remotes;
rm -rf origin;

这将删除 git log --all --decorate; 中的所有分支名称,但我不确定它是否安全。