How do you remove an invalid remote branch reference from Git?

前端 未结 11 2238
攒了一身酷
攒了一身酷 2020-11-28 16:43

In my current repo I have the following output:

$ git branch -a
* master
  remotes/origin/master
  remotes/public/master

I want to delete <

11条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 17:40

    I didn't know about git branch -rd, so the way I have solved issues like this for myself is to treat my repo as a remote repo and do a remote delete. git push . :refs/remotes/public/master. If the other ways don't work and you have some weird reference you want to get rid of, this raw way is surefire. It gives you the exact precision to remove (or create!) any kind of reference.

提交回复
热议问题