天天看点

Git- [!remote rejected]:refusing to delete the current branch 前言: 问题解读

前言:

这算是,在上篇博客 Git-error: dst refspec branch matches more than one 产生过程中的额外发现。

为了测试一些 git 命令的实现,我在 github 中新建了一个远程仓库 DR_testGit,测试后,我试图删除测试分支的时候,出现了下列提示:

Git- [!remote rejected]:refusing to delete the current branch 前言: 问题解读

问题解读

经历过上次的问题,我已经学会出了问题,Google 之前先首先仔细看看返回的错误提示。

![remote rejected] dev_test (refusing to delete the current branch: refs/heads/dev_test)

错误原因是删除命令被远程仓库拒绝,因为远程分支

dev_test

是当前分支。

那么,如何查看远程仓库的当前分支是什么?

1.登录你的 github 中进入 Repository 页面,

2.找到对应的远程仓库

3.点击 Setting页面,

4.选择 Branchs,找到 Default branch 项,就能查看和修改默认分支了。

如下:

Git- [!remote rejected]:refusing to delete the current branch 前言: 问题解读

修完完毕之后,不要忘记点击旁边的 update 按钮,update一下才能生效。

也许你和我一样,第一反应是看命令窗口中显示的当前分支,很不幸,是显示着当前分支却是

dev

,而不是

dev_test

,和错误提示不符合。原因是因为命令行窗口显示的是本地仓库的版本库,而错误提示是远程仓库发出的,请注意

[remote rejected]

字样。

欢迎关注个人微信公众号「浅浅同学的开发笔记」,最新的博客,好玩的事情,都会在上面分享,期待与你共同成长。

Git- [!remote rejected]:refusing to delete the current branch 前言: 问题解读