git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] branch renamed to 'HEAD'

From
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Date
Feb 27, 2017, 06:47 UTC
Message-ID
<20170227064724.fx246w4fn2morhb4@macbook.local>
In-Reply-To
<CAOLa=ZSyQg9uoZWADOMYc90U-5AR9Lfii9mjLre0m0FQCSqfxg@mail.gmail.com>
On Mon, Feb 27, 2017 at 11:43:46AM +0530, Karthik Nayak wrote:
Show 31 quoted lines
> Hello,
> 
> Thanks for reporting, but I don't think it is a bug.
> 
> On Mon, Feb 27, 2017 at 10:22 AM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> > Hi,
> >
> > I just discover something which very much seems a bug to me
> > while making an error in renaming a branch.
> > The scenario is the following:
> > - I have a branch named 'orig'
> > - I want to make some experimental changes on it:
> >         $ git checkout -b temp orig
> >         $ ... edit some files ...
> >         $ ... make some tests & commits ...
> > - I'm happy with my changes, so I want to have my original
> >   branch to now points to the head of this temp branch
> >   but did it wrongly:
> >         $ git branch -m -f orig @
> 
> Here you are using the '-m' flag, which is to rename a branch. So what
> you're essentially
> doing is:
>     $ git branch -m -f orig HEAD
> Do note that this won't reset 'orig' to point to 'HEAD', rather this
> renames 'orig' to 'HEAD'.
> 
> What you actually want to do (to reset 'orig' to 'HEAD') is:
>     $ git branch -f orig @
> This would make orig point to the current HEAD.
Sure. I said it the description that I made an error in the renaming.

What I consider as a bug is that '@', which stands for refs/HEAD, have been interpreted as a branch named 'HEAD' and thus created a reference refs/heads/HEAD.

Luc
Previous: Karthik NayakNext: Jeff King
Message 3 of 14 in “[BUG] branch renamed to 'HEAD'”
  1. Luc Van OostenryckFeb 27, 2017
  2. Karthik NayakFeb 27, 2017
  3. Luc Van OostenryckFeb 27, 2017
  4. Jeff KingFeb 27, 2017
  5. Jeff KingFeb 27, 2017
  6. Jeff KingFeb 27, 2017
  7. Luc Van OostenryckFeb 27, 2017
  8. Junio C HamanoFeb 27, 2017
  9. Jeff KingFeb 28, 2017
  10. Jacob KellerFeb 27, 2017
  11. Junio C HamanoFeb 28, 2017
  12. Jeff KingFeb 28, 2017
  13. Jacob KellerFeb 28, 2017
  14. Jeff KingFeb 28, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.