9

我最近在我的 Git 存储库配置文件中对我的远程存储库进行了一些更改。我重命名了远程名称,将我的来源更改为另一个远程仓库并重命名了我的旧来源。

例如,我以前有这个:

[remote "origin"]
   url =  blah blah

[remote "future"]
   url = blah blah

我进去改变了它们,使它们看起来像这样:

# formerly the origin
[remote "old-origin"]

# formerly the future repo
[remote "origin']

但是现在,当我输入时git branch -a,我看到从旧的“未来”遥控器中列出的分支:

remotes/origin/HEAD
remotes/origin/branch1
remotes/origin/branch2
remotes/future/branch1
remotes/future/branch2
remotes/old-origin/master
remotes/old-origin/branch3

我运行了 prune 和 fetch 等,但该列表不会更新。我在我的配置文件中搜索了“未来”,但没有任何结果。我可以运行任何命令来刷新此列表并停止查看那个不存在的遥控器吗?

4

1 回答 1

14

您曾经有一个名为 的遥控器future,而现在没有。

Hence, git remote whatever future can't help, because there is no remote named future. (Normally git remote update -p or git remote prune, as in the comments above, would let you get rid of these.)

The simplest option would seem to be to delete them manually:

git update-ref -d refs/remotes/future/branch1
git update-ref -d refs/remotes/future/branch2

(or rm -r .git/refs/remotes/future and/or edit .git/packed-refs, depending on whether these refs have gotten packed).

[Incidentally, I'd also run git config -e (or vi .git/config which is what I usually really do :-) ) and make sure there are no other left-over references to the future remote.]

于 2013-10-10T14:41:59.667 回答