简体   繁体   English

我不小心创建了一个名为-track的git本地分支,如何删除它?

[英]I accidentally created a git local branch called --track, how can I delete it?

I mistyped a git command which resulted in the creation of a local branch called, '--track'. 我输入了一个git命令,导致创建一个名为'--track'的本地分支。

I've tried the following: 我尝试过以下方法:

git branch -m --track delme
(this renames the current branch to delme, not the branch called --track)

git checkout --track
> fatal: --track needs a branch name

git branch -d --track
(does nothing, reports nothing)

git branch -D --track
(also does nothing)

git branch -d "--track"
(also does nothing

How can I delete this branch? 我该如何删除这个分支?

git branch -d -- --track

In general, -- tells git to treat all subsequent command-line arguments as non-options. 通常, --告诉git将所有后续命令行参数视为非选项。

EDIT: See the comments for clarification regarding how git uses -- . 编辑:请参阅评论,以了解git如何使用--

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM