强制删除 Git 中的一个分支?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41379997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Force-delete a branch in Git?
提问by Aditi Yadav
I have created a branch test
in my Git repository. Now I have no use for it. How can I force-delete this branch?
我test
在我的 Git 存储库中创建了一个分支。现在我没有用了。如何强制删除此分支?
I tried the following command:
我尝试了以下命令:
git branch -d test
But it returns an error.
但它返回一个错误。
回答by Brijesh
You can force-delete a branch with the following command:
您可以使用以下命令强制删除分支:
git branch -D test
By replacing -d
with -D
, you are telling git to delete the branch and that you don't care to merge changes from that branch.
通过替换-d
为-D
,您是在告诉 git 删除该分支,并且您不关心合并来自该分支的更改。
Be careful, you can lose data.
小心,您可能会丢失数据。