How do I delete a Git branch locally and remotely?

后端 未结 30 3593
被撕碎了的回忆
被撕碎了的回忆 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条回答
  •  你的背包
    2020-11-21 04:54

    Use:

    git push origin :bugfix  # Deletes remote branch
    git branch -d bugfix     # Must delete local branch manually
    

    If you are sure you want to delete it, run

    git branch -D bugfix
    

    Now to clean up deleted remote branches run

    git remote prune origin
    

提交回复
热议问题