* Fwd: Issue with Git Branch [not found] <56F9DC91-740F-47C7-9C2A-B6B1EC3A12B6@clicktherapeutics.com> @ 2020-01-13 0:01 ` Jude Guan Wang 2020-01-13 0:11 ` Taylor Blau 0 siblings, 1 reply; 5+ messages in thread From: Jude Guan Wang @ 2020-01-13 0:01 UTC (permalink / raw) To: git 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Issue with Git Branch 2020-01-13 0:01 ` Fwd: Issue with Git Branch Jude Guan Wang @ 2020-01-13 0:11 ` Taylor Blau 2020-01-13 0:42 ` SZEDER Gábor 0 siblings, 1 reply; 5+ messages in thread From: Taylor Blau @ 2020-01-13 0:11 UTC (permalink / raw) To: Jude Guan Wang; +Cc: git Hi Jude, On Sun, Jan 12, 2020 at 07:01:04PM -0500, Jude Guan Wang wrote: > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Issue with Git Branch 2020-01-13 0:11 ` Taylor Blau @ 2020-01-13 0:42 ` SZEDER Gábor 2020-01-13 0:48 ` Taylor Blau 0 siblings, 1 reply; 5+ messages in thread From: SZEDER Gábor @ 2020-01-13 0:42 UTC (permalink / raw) To: Taylor Blau; +Cc: Jude Guan Wang, git On Sun, Jan 12, 2020 at 04:11:43PM -0800, Taylor Blau wrote: > On Sun, Jan 12, 2020 at 07:01:04PM -0500, Jude Guan Wang wrote: > > 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. > 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. $ git update-ref refs/heads/-D master $ git branch |head -n1 -D ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Issue with Git Branch 2020-01-13 0:42 ` SZEDER Gábor @ 2020-01-13 0:48 ` Taylor Blau 2020-01-13 11:26 ` SZEDER Gábor 0 siblings, 1 reply; 5+ messages in thread From: Taylor Blau @ 2020-01-13 0:48 UTC (permalink / raw) To: SZEDER Gábor; +Cc: Taylor Blau, Jude Guan Wang, git On Mon, Jan 13, 2020 at 01:42:35AM +0100, SZEDER Gábor wrote: > On Sun, Jan 12, 2020 at 04:11:43PM -0800, Taylor Blau wrote: > > On Sun, Jan 12, 2020 at 07:01:04PM -0500, Jude Guan Wang wrote: > > > 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. > > > 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. > > $ git update-ref refs/heads/-D master > $ git branch |head -n1 > -D I was assuming that Jude had gotten the ref to appear by using 'git branch' alone, i.e., without the help of 'git update-ref' or 'cp .git/refs/heads/{master,-D}'. Thanks, Taylor ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Issue with Git Branch 2020-01-13 0:48 ` Taylor Blau @ 2020-01-13 11:26 ` SZEDER Gábor 0 siblings, 0 replies; 5+ messages in thread From: SZEDER Gábor @ 2020-01-13 11:26 UTC (permalink / raw) To: Taylor Blau; +Cc: Jude Guan Wang, git On Sun, Jan 12, 2020 at 04:48:14PM -0800, Taylor Blau wrote: > On Mon, Jan 13, 2020 at 01:42:35AM +0100, SZEDER Gábor wrote: > > On Sun, Jan 12, 2020 at 04:11:43PM -0800, Taylor Blau wrote: > > > On Sun, Jan 12, 2020 at 07:01:04PM -0500, Jude Guan Wang wrote: > > > > 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. > > > > > 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. > > > > $ git update-ref refs/heads/-D master > > $ git branch |head -n1 > > -D > > I was assuming that Jude had gotten the ref to appear by using 'git > branch' alone, i.e., without the help of 'git update-ref' or 'cp > .git/refs/heads/{master,-D}'. On a somewhat related note, while trying whether I could "inadvertently" create such a branch with gitk I stumbled upon this bit of weirdness: $ git rev-parse v2.24.0^{commit} da72936f544fec5a335e66432610e4cef4430991 $ git branch da72936f544fec5a335e66432610e4cef4430991 v2.24.0 $ gitk -1 v2.24.0 (While starting up gitk might show a popup warning about the branch with 40 hexdigit name, close it.) So now gitk displays a commit with the v2.24.0 tag and the da7293... branch pointing to it. Right click on the commit's subject line, select "Create new branch" from the context menu. Enter "-D" as the name of the new branch, and click Create. Now gitk displays a "-D" branch pointing to the same commit as well, but it's only a display thing, as it did not actually create that branch, because it carelessly run the 'git branch -D da7293...' command... After refreshing with F5 it won't display the da7293... and "-D" branches. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-01-13 11:26 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <56F9DC91-740F-47C7-9C2A-B6B1EC3A12B6@clicktherapeutics.com> 2020-01-13 0:01 ` Fwd: Issue with Git Branch Jude Guan Wang 2020-01-13 0:11 ` Taylor Blau 2020-01-13 0:42 ` SZEDER Gábor 2020-01-13 0:48 ` Taylor Blau 2020-01-13 11:26 ` SZEDER Gábor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).