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

前端 未结 11 2243
攒了一身酷
攒了一身酷 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:25

    I had a similar problem. None of the answers helped. In my case, I had two removed remote repositories showing up permanently.

    My last idea was to remove all references to it by hand.

    Let's say the repository is called “Repo”. I did:

    find .git -name Repo 
    

    So, I deleted the corresponding files and directories from the .git folder (this folder could be found in your Rails app or on your computer https://stackoverflow.com/a/19538763/6638513).

    Then I did:

    grep Repo -r .git
    

    This found some text files in which I removed the corresponding lines. Now, everything seems to be fine.

    Usually, you should leave this job to git.

提交回复
热议问题