How to delete a local branch in git?

前端 未结 3 1297
南旧
南旧 2021-01-16 17:04

I want to delete a local branch in Git but this failed:

git branch -d 
相关标签:
3条回答
  • 2021-01-16 17:48

    If you edit your branch & want to delete it without merging it to your master branch, you have to force delete it with the option -D instead of -d.

    git branch -D <branch_name>
    
    0 讨论(0)
  • 2021-01-16 17:56
    git branch -D <branch_name>
    
    0 讨论(0)
  • 2021-01-16 18:01

    Your command to delete a branch is correct:

    git branch -d <branch_name>
    

    But you may have an error message indicating you need to use the -D option to force the deletion of the branch:

    git branch -D <branch_name>
    
    0 讨论(0)
提交回复
热议问题