Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

I mistyped a git command which resulted in the creation of a local branch called, '--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?

like image 240
Rich Avatar asked May 02 '10 02:05

Rich


1 Answers

git branch -d -- --track

In general, -- tells git to treat all subsequent command-line arguments as non-options.

EDIT: See the comments for clarification regarding how git uses --.

like image 132
Marcelo Cantos Avatar answered Oct 07 '22 21:10

Marcelo Cantos