How do I delete a Git branch locally and remotely?

后端 未结 30 3607
被撕碎了的回忆
被撕碎了的回忆 2020-11-21 04:11

I want to delete a branch both locally and remotely.

Failed Attempts to Delete a Remote Branch

$ git branch -d         


        
30条回答
  •  -上瘾入骨i
    2020-11-21 05:05

    If you want to delete a branch, first checkout to the branch other than the branch to be deleted.

    git checkout other_than_branch_to_be_deleted
    

    Deleting the local branch:

    git branch -D branch_to_be_deleted
    

    Deleting the remote branch:

    git push origin --delete branch_to_be_deleted
    

提交回复
热议问题