Re: Fwd: Issue with Git Branch
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Jan 13, 2020, 00:11 UTC
- Message-ID
- <20200113001143.GA13099@syl.local>
- In-Reply-To
- <29742805-4992-47E6-9889-F55F5EFBBFF1@clicktherapeutics.com>
Hi Jude,
On Sun, Jan 12, 2020 at 07:01:04PM -0500, Jude Guan Wang wrote:
Show 9 quoted lines
> Hi, all: > I noticed something weird with my git command. In my local > environment I seem to have a branch named `-D`: > > And I don’t remember how I was able to create a branch like that. I > tried to do git branch -D/-d this branch but seems not working. I’m > assuming the branch infos were kept in .git folder so my question is > if there’s anyway I could remove this invalid branch from that > folder? My git version is 2.24.0. Thanks for any help in advance.
You can delete oddly-named branches by passing the end-of-options marker to 'git branch', like so:
$ git branch -D --end-of-options -D
(In fact, '--end-of-options' isn't strictly necessary here, and using '--' as in 'git branch -D -- -D' will work as well).
If you do find a reproducible way to create branches named '-D' or similar, please do let us know, as these are not intended to be valid branch names in general.
Thanks, Taylor