Reputation: 315
I was trying to track a remote branch with $ git checkout -b --track global/master
, and git created a branch named "--track". Now, when I run $ git branch -D --track
it won't delete the branch. I believe Git is parsing the last argument, --track
, as a git-branch
subcommand flag, not a branch name.
I attempted to quote the branch name with $ git branch -D '--track'
and escape the leading hyphen with $ git branch -D \--track
.
How can I delete the "--track" branch?
Upvotes: 13
Views: 16430
Reputation: 10992
As Uli Köhler already said:
git branch -D -- --track
The command will work to delete your branch.
Upvotes: 6