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

Re: Keeping reflogs on branch deletion

From
Nicolas Pitre <nico@cam.org>
Date
Feb 14, 2008, 16:16 UTC
Message-ID
<alpine.LFD.1.00.0802141103280.2732@xanadu.home>
In-Reply-To
<20080214151752.GB3889@coredump.intra.peff.net>
On Thu, 14 Feb 2008, Jeff King wrote:
Show 12 quoted lines
> On Thu, Feb 14, 2008 at 10:00:58AM -0500, Nicolas Pitre wrote:
> 
> > > When deleting a branch, is there any reason we can't add a deletion
> > > entry into the reflog and keep the reflog around?  This would seem to be
> > > a lot safer; I know I've been burned by expecting the reflog safety net
> > > to be there, and surprised that it's not when I've deleted a branch.
> > 
> > No.  That would only accumulate dead reflog files in the repository.
> 
> How is that any different than accumulating old entries in reflog files
> for branches that _do_ exist? In both cases, they should be dealt with
> via time-based pruning.

Branches that do exist are more likely to be interesting to you than branches that, hopefully in 99% of all cases, you willfully deleted.

Show 10 quoted lines
> > And as Junio said above, the "HEAD" reflog contains everything you moved 
> > to, including detached heads, and of course branch heads that might now 
> > be deleted.  You can easily retrieve a deleted branch head from there.
> 
> By that rationale, why do we bother keeping any reflog besides HEAD in
> the first place? I can think of two reasons:
> 
>   1. it's much more convenient to type branch@{1} than to sift through
>      HEAD's reflog looking for checkout events and guessing which branch
>      we were on

Exact. But that doesn't apply to non existent branches, surely? And what would you do with the reflog of a deleted branch when a new branch is created with the same name?

>   2. it's possible to change a ref without it being on the HEAD, in
>      which case the HEAD reflog doesn't contain the change.

And in those cases this can't be due to your own modifications, hence nothing valuable is lost if you then delete that branch.

> In other words, I don't see "oops, I deleted this branch and its history
> is valuable to me" as significantly less likely than "oops, I got rid of
> this commit and its history is valuable to me."

But you still have it, in the HEAD reflog, at least for your own changes. I therefore don't see the value of having to keep named branch reflogs around just for the small convenience, especially with the semantic issues that comes with it.

Nicolas
Previous: Jeff KingNext: Jeff King
Message 10 of 15 in “A couple branch questions”
  1. Jay SoffianFeb 14, 2008
  2. David SymondsFeb 14, 2008
  3. Bill LearFeb 14, 2008
  4. David SymondsFeb 14, 2008
  5. Junio C HamanoFeb 14, 2008
  6. Keeping reflogs on branch deletionBrian Downing, Feb 14, 2008
  7. Nicolas PitreFeb 14, 2008
  8. Johannes SchindelinFeb 14, 2008
  9. Jeff KingFeb 14, 2008
  10. Nicolas PitreFeb 14, 2008
  11. Jeff KingFeb 14, 2008
  12. Nicolas PitreFeb 14, 2008
  13. Jeff KingFeb 14, 2008
  14. Wincent ColaiutaFeb 14, 2008
  15. Jakub NarebskiFeb 14, 2008

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.