Delete broken branch in git

前端 未结 6 1810
旧时难觅i
旧时难觅i 2020-12-24 12:44

I have created branch with \"git checkout -b mybranch\". It seems that something went wrong, and now I can\'t delete it using \"git branch -D mybranch\". It says: error: bra

6条回答
  •  没有蜡笔的小新
    2020-12-24 13:50

    I have the same problem git branch -d was not working, And I didn't found anything in .git/packed-refs and .git/refs/heads but I got files in

    .git/refs/remotes/origin

    with the name of the branches that I was not able to delete locally as well as in remote. But after deleting the files with the branch_name that I wanted to delete it was not showing in local.

    To delete it on remote use

    git fetch -p origin

    The -p --prune option tells that before fetching, remove any remote-tracking references that no longer exist on the remote. Then use command

    git push origin :

    to delete on remote.

    And you are done. :)

提交回复
热议问题