threads / discuss / 25588

Unable to remove git branch

Subject: Unable to remove git branch

## tl;dr

5 messages between Oct 29, 2010 and Oct 29, 2010.

replies: 4people: 3as markdown or json

Sascha Peilicke· Oct 29, 2010, 07:43 UTC · lore
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· Oct 29, 2010, 07:54 UTC · re: Sascha Peilicke · lore

Re: Unable to remove git branch

Sascha Peilicke wrote:
Show 11 quoted lines
> 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· Oct 29, 2010, 07:56 UTC · re: Mathias Lafeldt · lore

Re: Unable to remove git branch

Mathias Lafeldt wrote:
Show 16 quoted lines
> 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· Oct 29, 2010, 08:31 UTC · re: Mathias Lafeldt · lore

Re: Unable to remove git branch

On Friday 29 October 2010 09:56:50 you wrote:
Show 21 quoted lines
> 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

← back to recent threads