what's difference about git branch -d and git branch -D

后端 未结 2 652
小蘑菇
小蘑菇 2021-01-03 16:02

I an newer about git. after I merge my branch from another branch, I found something wrong. Now my status is I have commit these changes from merging, but not push into the

相关标签:
2条回答
  • 2021-01-03 16:48

    You can find the answer using git help branch. (Because it is regarding the git branch command.)

    There you find:

    -d
    --delete
    
        Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream.
    -D
    
        Delete a branch irrespective of its merged status.
    

    Usually you do git branch -d. - If git complains, you should think again and if you are sure you do not need any commits from that branch anymore you can do git branch -D to delete it anyway.

    0 讨论(0)
  • 2021-01-03 17:01

    The -D is a force-delete and the -d will provide a warning before deleting if the branch has not been merged into its upstream branch

    0 讨论(0)
提交回复
热议问题