How to remove a git branch named "--track"

I made a mistake when checking out a new branch with git. git version 1.7.1

I started git branch -b --track origin/developand got a branch with a name --track. How to remove it?

What I've done:

$ git branch
--track
* develop
master

$ git branch -d --track
$ git branch -d "--track"
$ git branch -D --track
$ git branch -D "--track"
$ git branch -D '--track'
$ git branch
--track
* develop
master
+4
source share
3 answers

Instead of trying to figure out (if there is) a way to get git tools for this, you can simply

rm .git/refs/heads/--track
+4
source

The hobbs' method will probably work . If this fails, you can use git update-refto remove the branch name in a way that also will not start with -:

git update-ref -d refs/heads/--track

This should work even if the branch is packed.

+4
source

Try

git branch -D -- --track

-- separates parameters from arguments.

0
source

Source: https://habr.com/ru/post/1690657/


All Articles