5

So I ran this command:

git checkout -b --track origin/RB_1.4.5

I thought that it would create a local branch by the same name and set it up to track the remote branch, but instead it created a branch called --track. I could have sworn that omitting the local branch name will normally cause it to assume you want the same name as the remote branch, but I guess this wasn't the case.

Now running:

git branch

gives me:

* --track
  master

I've tried checking out master and then running:

git branch -D --track  (as well as "--track")

but that doesn't do anything (no errors or anything).

I tried removing the corresponding lines in .git/config, but still no dice.

How can I remove that branch? Also, in the future, is there a way to do what I wanted and still not have to re-type the local branch name?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
solidcell
  • 7,639
  • 4
  • 40
  • 59
  • I just tried it with the options reversed, and this time it created a local branch from master called "origin/RB_1.4.5". Deleting it wasn't a problem however. I guess you're just forced to re-type the local branch name :( – solidcell May 03 '11 at 18:24

1 Answers1

8

Try

git branch -D -- --track

Should tell git to ignore dashes after --

tauran
  • 7,986
  • 6
  • 41
  • 48