Switch current branch in git bare repository

淺唱寂寞╮ 提交于 2019-12-12 07:28:50

问题


I actually want to remove a branch in the bare repository i am working with, but this task hits a dead end because I cannot switch away from the master repository without a 'work tree' which a bare repository does not have.

When I run git branch -d master the output is:

error: Cannot delete the branch 'master' which you are currently on.

So I try to switch to another branch called 'develop' by running git checkout develop and the output is:

fatal: This operation must be run in a work tree

回答1:


Try this instead of git checkout:

git symbolic-ref HEAD refs/heads/develop

Then you should be able to delete master.



来源:https://stackoverflow.com/questions/4468322/switch-current-branch-in-git-bare-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!