在删除git中的分支时使用-d和-D有什么区别? [英] What is the difference between using -d and -D when deleting a branch in git?

查看:1816
本文介绍了在删除git中的分支时使用-d和-D有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Can some body please help me to understand what is the difference between following two git commands?

可以通过一些机构来帮助我理解下面两个git命令之间的区别吗?测试

$ git branch -d testing

$ git branch -D testing

何时应该使用-D?

推荐答案

git branch -d 用于删除上游完全合并的分支如果你的分支没有上游,那么你可以分支或者分配给HEAD。如果分支未完全合并,它将不会执行删除操作。

git branch -d is for deleting branches that are fully merged in its upstream branch or to HEAD if you don't have a upstream for your branch. If the branch is not fully merged it will not perform the deletion.

git分支-D 删除分支甚至如果它没有合并。

git branch -D deletes the branch even if it's not merged.

这篇关于在删除git中的分支时使用-d和-D有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆