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

Re: Deleting remote branches with git-branch and reflog questions

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 24, 2007, 09:58 UTC
Message-ID
<Pine.LNX.4.63.0701241054330.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<Pine.LNX.4.64.0701232103290.3011@xanadu.home>
Hi,
On Tue, 23 Jan 2007, Nicolas Pitre wrote:
Show 34 quoted lines
> On Tue, 23 Jan 2007, Junio C Hamano wrote:
> 
> > Nicolas Pitre <nico@cam.org> writes:
> > 
> > > On Tue, 23 Jan 2007, Junio C Hamano wrote:
> > >
> > >> And we might want to allow reflogs on detached HEAD someday,
> > >> although I personally think it goes against what detached HEAD
> > >> is -- it is of a very temporary nature.
> > >
> > > Didn't we agree already that reflog with detached head was simply 
> > > insane?
> > 
> > Perhaps, perhaps not.
> > 
> > 	$ git checkout v2.6.14
> >         $ git checkout v2.6.15
> >         $ git checkout v2.6.16
> > 
> > Ah, which one did I check-out the last time?
> > 
> > 	$ git describe HEAD@{1}
> 
> And what does HEAD@{1} means if not detached?
> 
> If there is a reflog for HEAD independently of what branch HEAD is 
> attached to then it could make sense.  Meaning that if you're on branch 
> "master" and perform a commit, then both reflogs for "master" and "HEAD" 
> are updated at the same time.  If you then checkout branch "next" then 
> only the "HEAD" reflog is updated since no changes to any branch did 
> occur but just HEAD changed.
> 
> Then moving around and/or committing with a detached head would just 
> update the "HEAD reflog.

This would also be my idea. I agree with you that mixing approaches like Jakub proposed is insane.

But given the idea of reflogs ("Where was this yesterday"), I think it would make sense to reflog HEAD -- independent on which branch it happens to refer to.

Warning! It _changes_ the behaviour. As of now, "git log --walk-reflogs HEAD" shows the local view of the _branch_ that HEAD points to _currently_. But I think that the current is difficult to explain to new users, whereas the "jumping HEAD" is not.

Ciao, Dscho

Previous: Nicolas PitreNext: Jakub Narebski
Message 12 of 16 in “Deleting remote branches with git-branch and reflog questions”
  1. Andy ParkinsJan 23, 2007
  2. Andreas EricssonJan 23, 2007
  3. Andy ParkinsJan 23, 2007
  4. Junio C HamanoJan 23, 2007
  5. Johannes SchindelinJan 23, 2007
  6. Nicolas PitreJan 23, 2007
  7. Johannes SchindelinJan 23, 2007
  8. Junio C HamanoJan 24, 2007
  9. Nicolas PitreJan 24, 2007
  10. Jakub NarebskiJan 24, 2007
  11. Nicolas PitreJan 24, 2007
  12. Johannes SchindelinJan 24, 2007
  13. Jakub NarebskiJan 23, 2007
  14. Andy ParkinsJan 23, 2007
  15. Johannes SchindelinJan 23, 2007
  16. Andy ParkinsJan 23, 2007

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.