Remove branches for remote that no longer exists

When I run the command git branch -a I see a list of branches associated with a remote that no longer exists. ex:

remotes/does-not-exist/branch1
remotes/does-not-exist/branch2
remotes/origin/dev
remotes/origin/feature3

I want to remove the branches associated with does-not-exist from the list above. However if I run the command git remote prune does-not-exist I get the following error

conq: repository does not exist.
fatal: Could not read from remote repository.

How can I remove the branches associated with does-not-exist ? Should I just delete the folder under .git/refs/remotes/ ?


To delete remote branches, I run git push origin --delete <branch> . So in your case, you may run the following:

git push does-not-exist --delete branch1
git push does-not-exist --delete branch2

I hope this helps.


You should remove the remote, not branches. By this the branches will be deleted too. git remote remove does-not-exist .

链接地址: http://www.djcxy.com/p/26014.html

上一篇: 如何删除不再有效的旧远程参考

下一篇: 删除不再存在的远程分支