Geoffrey Hale
Geoffrey Hale

Reputation: 11438

How to delete git branch named "--help"?

I accidentally created a local branch named --help and can't figure out how to delete it. The usual -D or --delete doesn't work when followed by the --help. It just outputs help text:

$ git branch -D --help
usage: git branch [options] [-r | -a] [--merged | --no-merged]
   or: git branch [options]...etc

I've tried single ' and double " quotes and get the same result.

Upvotes: 1

Views: 29

Answers (1)

Geoffrey Hale
Geoffrey Hale

Reputation: 11438

git branch -D -- --help

The first -- is used to avoid parsing --help as a command line option.

Source: https://unix.stackexchange.com/a/1520/140838

Upvotes: 3

Related Questions