# Unable to remove git branch

5 messages from 2010-10-29 to 2010-10-29. Participants: Sascha Peilicke, Mathias Lafeldt, Jonathan Nieder.
Thread: https://gitlist.dev/t/25588

## Sascha Peilicke, 2010-10-29 07:43

Subject: Unable to remove git branch
Message-ID: <201010290943.13177.sasch.pe@gmx.de>
URL: https://gitlist.dev/e/201010290943.13177.sasch.pe%40gmx.de

```
Hi guys,

I accidentally did an 'git co -b --track origin/foo' ending up with a local 
branch '--track'. Sadly, git is unable to remove or rename that branch because 
it always interprets it as a parameter. 

As a consequence, 'git br -d "--track"' does nothing and 'git br -m "--track" 
foo' even renames the current branch, say, master,  to 'foo'. Any hints on how 
to get rid of that pesky branch?

BTW please CC me as I'm not subscribed to this list.
-- 
Mit freundlichen Grüßen,
Sascha Peilicke
http://saschpe.wordpress.com

```

## Mathias Lafeldt, 2010-10-29 07:54

Subject: Re: Unable to remove git branch
Message-ID: <4CCA7DA8.3020607@debugon.org>
URL: https://gitlist.dev/e/4CCA7DA8.3020607%40debugon.org
In-Reply-To: <201010290943.13177.sasch.pe@gmx.de>

```
Sascha Peilicke wrote:
> Hi guys,
> 
> I accidentally did an 'git co -b --track origin/foo' ending up with a local 
> branch '--track'. Sadly, git is unable to remove or rename that branch because 
> it always interprets it as a parameter. 
> 
> As a consequence, 'git br -d "--track"' does nothing and 'git br -m "--track" 
> foo' even renames the current branch, say, master,  to 'foo'. Any hints on how 
> to get rid of that pesky branch?
> 
> BTW please CC me as I'm not subscribed to this list.

Try:

$ git br -D -- --track

-Mathias

```

## Mathias Lafeldt, 2010-10-29 07:56

Subject: Re: Unable to remove git branch
Message-ID: <4CCA7E42.7080906@debugon.org>
URL: https://gitlist.dev/e/4CCA7E42.7080906%40debugon.org
In-Reply-To: <4CCA7DA8.3020607@debugon.org>

```
Mathias Lafeldt wrote:
> Sascha Peilicke wrote:
>> Hi guys,
>>
>> I accidentally did an 'git co -b --track origin/foo' ending up with a local 
>> branch '--track'. Sadly, git is unable to remove or rename that branch because 
>> it always interprets it as a parameter. 
>>
>> As a consequence, 'git br -d "--track"' does nothing and 'git br -m "--track" 
>> foo' even renames the current branch, say, master,  to 'foo'. Any hints on how 
>> to get rid of that pesky branch?
>>
>> BTW please CC me as I'm not subscribed to this list.
> 
> Try:
> 
> $ git br -D -- --track

It really should be:

$ git branch -D -- --track

('br' is an alias of mine)

Sorry for the noise.

-Mathias

```

## Sascha Peilicke, 2010-10-29 08:31

Subject: Re: Unable to remove git branch
Message-ID: <201010291031.42305.sasch.pe@gmx.de>
URL: https://gitlist.dev/e/201010291031.42305.sasch.pe%40gmx.de
In-Reply-To: <4CCA7E42.7080906@debugon.org>

```
On Friday 29 October 2010 09:56:50 you wrote:
> Mathias Lafeldt wrote:
> > Sascha Peilicke wrote:
> >> Hi guys,
> >> 
> >> I accidentally did an 'git co -b --track origin/foo' ending up with a
> >> local branch '--track'. Sadly, git is unable to remove or rename that
> >> branch because it always interprets it as a parameter.
> >> 
> >> As a consequence, 'git br -d "--track"' does nothing and 'git br -m
> >> "--track" foo' even renames the current branch, say, master,  to 'foo'.
> >> Any hints on how to get rid of that pesky branch?
> >> 
> >> BTW please CC me as I'm not subscribed to this list.
> > 
> > Try:
> > 
> > $ git br -D -- --track
> 
> It really should be:
> 
> $ git branch -D -- --track

Thanks, that worked. Maybe '-' should not be allowed as the first char in a 
branch name?
-- 
Mit freundlichen Grüßen,
Sascha Peilicke
http://saschpe.wordpress.com

```

## Jonathan Nieder, 2010-10-29 08:42

Subject: Re: Unable to remove git branch
Message-ID: <20101029084244.GD26290@burratino>
URL: https://gitlist.dev/e/20101029084244.GD26290%40burratino
In-Reply-To: <201010291031.42305.sasch.pe@gmx.de>

```
Sascha Peilicke wrote:

>                      Maybe '-' should not be allowed as the first char in a 
> branch name?

Heh - see 6348624 (disallow branch names that start with a hyphen,
2010-09-14).

```
