git git无法删除本地分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22108565/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:47:28  来源:igfitidea点击:

git cannot delete local branch

gitgit-branch

提问by Shane

I was trying to track a remote branch with:

我试图跟踪一个远程分支:

$ git checkout -b --track global/master

and git created a branch that is actually called '--track'+ Now when I type:

并且 git 创建了一个实际上称为 '--track'+ 的分支,现在当我输入时:

$ git branch -D --track

It won't delete the branch (I think git is assuming it is a flag/option not a branch name)

它不会删除分支(我认为 git 假设它是一个标志/选项而不是分支名称)

I also tried

我也试过

$ git branch -D '--track'

and

$ git branch -D \--track

no results

没有结果

UPDATE=============================

更新==============================

Thanks... that worked:

谢谢...有效:

$ git branch -D -- --track

采纳答案by Langusten Gustel

As Uli K?hleralready said:

正如Uli K?hler已经说过的:

git branch -D -- --track

The command will work to delete your branch.

该命令将用于删除您的分支。