Skip to contentSkip to conversation

Unable to remove git branch

DISCUSSION Sascha Peilicke 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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.

Signature · 3 lines
Mit freundlichen Grüßen,
Sascha Peilicke
http://saschpe.wordpress.com
#1 lore raw
Quoted 11 lines · Sascha Peilicke

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

#2 lore raw
Quoted 11 lines · Mathias Lafeldt
Quoted 10 lines · Sascha Peilicke

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?

Quoted 5 lines
Quoted 1 line

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

#3 lore raw
Quoted 14 lines · On Friday 29 October 2010 09:56:50 you wrote:
Quoted 13 lines · Mathias Lafeldt
Quoted 11 lines · Sascha Peilicke

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.

Quoted 7 lines
Quoted 3 lines

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?

Signature · 3 lines
Mit freundlichen Grüßen,
Sascha Peilicke
http://saschpe.wordpress.com
#4 lore raw
Quoted 2 lines · Sascha Peilicke

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).