我从一个不再存在的仓库中删除本地分支时遇到了一些问题。
William@WILLIAM /c/xampp/htdocs/apeppers (master)
$ git fetch --prune
fatal: repository 'https://williamcalderipe@bitbucket.org/williamcalderipe/myRepo.git/' not found
我想删除'(master)'
William@WILLIAM /c/xampp/htdocs/apeppers (master)
$ git push origin :master
Password for 'https://williamcalderipe@bitbucket.org':
error: unable to delete 'master': remote ref does not exist
error: failed to push some refs to 'https://williamcalderipe@bitbuck
William@WILLIAM /c/xampp/htdocs/apeppers (master)
$ git branch -d master
error: Cannot delete the branch 'master' which you are currently on.
答案 0 :(得分:1)
在删除本地分支之前,您需要签出另一个分支:
git checkout some_other_branch
git branch -D master
您应该使用-D
而不是-d
,因为遥控器不存在并不重要。
我不确定你为什么要删除分支主机,所以请在执行此操作之前运行以下内容并保存输出,以防万一你后悔更容易撤消:
git checkout master
git rev-parse HEAD
并保存输出。