How do I delete a Git branch locally and remotely?

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

    Matthew's answer is great for removing remote branches and I also appreciate the explanation, but to make a simple distinction between the two commands:

    To remove a local branch from your machine:

    git branch -d {the_local_branch} (use -D instead to force deleting the branch without checking merged status)

    To remove a remote branch from the server:

    git push origin --delete {the_remote_branch}

    Reference: Git: Delete a branch (local or remote)

提交回复
热议问题