How do I delete a Git branch locally and remotely?

后端 未结 30 3616
被撕碎了的回忆
被撕碎了的回忆 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 05:05

    Delete locally:

    To delete a local branch, you can use:

    git branch -d 
    

    To delete a branch forcibly, use -D instead of -d.

    git branch -D 
    

    Delete remotely:

    There are two options:

    git push origin :branchname
    
    git push origin --delete branchname
    

    I would suggest you use the second way as it is more intuitive.

提交回复
热议问题