【发布时间】:2023-03-14 01:44:01
【问题描述】:
我正在尝试使用
删除远程 git 分支git push origin :my_remote_branch
得到:
error: unable to push to unqualified destination: my_remote_branch
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@example.com:/myrepo'
这些是我目前的分支
git branch -a
* develop
master
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/my_remote_branch
git branch -r --merged
origin/HEAD -> origin/master
origin/develop
origin/master
任何关于我如何摆脱这个分支的想法都将不胜感激。
【问题讨论】:
-
你试过
git fetch看看它是否修复了那个不存在的远程名称吗?您是否尝试进入您的.git\refs\remotes\origin并删除my_remote_branch文件,看看是否足够? -
做了
git fetch但这没有帮助。在尝试手动删除文件之前,将尝试搜索更直接的解决方案。 -
尝试删除或至少移动该文件:它仅包含该分支尖端的 SHA1。
-
您必须执行
git fetch -p才能摆脱陈旧的跟踪分支。
标签: git