如何删除一个名为' -delete'的分支?
我意外地创建了一个名为-delete的本地分支
当我尝试运行命令以使用它删除分支的命令时,
git branch -d -delete
git branch -D -delete
git branch --delete -delete
,并给出了错误的消息,说:
error: did you mean `--delete` (with two dashes ?)
如何删除“ -delete”分支?
I have accidentally created a local branch called -delete
When I try to run commands to delete the branch using
git branch -d -delete
git branch -D -delete
git branch --delete -delete
It does not work and gives the error message back that says this:
error: did you mean `--delete` (with two dashes ?)
How can I delete the '-delete' branch?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
git分支
还要尊敬-
章节:如果您通过-
单独作为命令行上的参数,那么此后的任何内容都不会是被解释为一种选择。从 @torek在
git branch
also honors the--
convention : if you pass--
alone as an argument on the command line, anything after that will not be interpreted as an option.Starting from @torek's setup in his answer :
没有以用户为导向的git命令让您首先让您创建该分支名称(我不得不求助于骗子来自己设置条件,因为我不认为使用
> git update-ref
立即),但是一旦拥有,摆脱错误名称的方法是使用git git update-ref
:这是我的示例:
No user-oriented Git command should have let you create that branch name in the first place (I had to resort to trickery to set up the condition myself, as I didn't think to use
git update-ref
right off), but once you have it, the way to get rid of the bad name is to usegit update-ref
:Here's my example:
我遇到了同样的问题。我发现的唯一方法是通过git gui删除它。
1-右键单击您的项目目录,然后在此处单击GIT GUI
2-从Navbar单击分支,然后单击删除
3-从本地分支框和下面的第二个框中选择分支,然后单击
完成的 删除
在此处输入图像描述
I had the same problem. The only way that I found was to delete it by git GUI.
1- Right click in your project directory and then click on git GUI here
2- From the navbar click on branch then click on delete
3- choose the branch from the local branches box and the second box below, then click on the delete
Done
enter image description here