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

Re: can we prevent reflog deletion when branch is deleted?

From
Jeff King <peff@peff.net>
Date
Jun 1, 2013, 09:09 UTC
Message-ID
<20130601090934.GA13904@sigill.intra.peff.net>
In-Reply-To
<CALkWK0kcJH0t4i0BAPmMkNWwNzeJNdmg_wbt3ao-=R31kJ5noA@mail.gmail.com>
On Sat, Jun 01, 2013 at 01:29:07PM +0530, Ramkumar Ramachandra wrote:
Show 11 quoted lines
> Jeff King wrote:
> > I wonder if simply sticking
> > the reflog entries into a big GRAVEYARD reflog wouldn't be a great deal
> > simpler and accomplish the "keep deleted reflogs" goal, which is what
> > people actually want.
> 
> Exactly what I was thinking when I read your proposal.  What is the
> point of having individual graveyards for deleted branches?  The
> branch names no longer have any significance, and separating the
> reflogs using branch names nobody remembers is only making
> discoverability harder.

Why don't the branch names have significance? If I deleted branch "foo" yesterday evening, wouldn't I want to be able to say "show me foo from 2pm yesterday" or even "show me all logs for foo, so that I can pick the useful bit from the list"?

When I suggested a big graveyard reflog, I did not mean a straight concatenation of the deleted reflogs; I meant one which would also record the name of the ref whose log each entry came from.

If you mean "the branch names in the filesystem don't have significance", I agree. Using a parallel hierarchy of reflogs was an implementation choice that let us use the same reflog format. Defining a new GRAVEYARD format would need an additional field for the ref name of each entry, but lets us drop the other naming complexities.

> What is the problem we are trying to solve?  Someone deletes a branch
> by mistake, and wants to get it back?  There's the HEAD reflog for
> that.
The HEAD reflog is not sufficient for two reasons:
  1. Not all ref updates were part of the HEAD reflog (e.g.,
     refs/remotes, tags).
  2. It is not easy to see deduce which ref each entry comes from, which
     makes "deleted_branch@{yesterday}" difficult. You can sometimes
     deduce the branch by reading the surrounding entries (e.g., for
     "checkout" entries), but I do not know offhand whether it can be
     done reliably in all cases (I suspect not, given that unreachable
     reflog entries may be pruned sooner than reachable ones, leaving
     "holes" in the reflog's story).
> More than adding a graveyard to provide hard-to-dissect information,
> I'm interested in tooling support for the information we already have.

I think that is an orthogonal concern. Already with the current reflogs, such a tool would be useful. And even without such a tool, being able to access reflog entries of deleted branches is still useful. Even simple things like "git branch foo deleted@{yesterday}" and "git log -g deleted" would give a safety net. And those are supported by the existing porcelain tooling.

I do not necessarily disagree with your criticisms of the tooling around reflogs, but they are just not my interest right now, and I do not think working on one concept needs to hold up the other.

-Peff
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 5 of 21 in “can we prevent reflog deletion when branch is deleted?”
  1. Sitaram ChamartyJun 1, 2013
  2. Michael HaggertyJun 1, 2013
  3. Jeff KingJun 1, 2013
  4. Ramkumar RamachandraJun 1, 2013
  5. Jeff KingJun 1, 2013
  6. Ramkumar RamachandraJun 1, 2013
  7. Sitaram ChamartyJun 1, 2013
  8. Ramkumar RamachandraJun 1, 2013
  9. Sitaram ChamartyJun 2, 2013
  10. Sitaram ChamartyNov 14, 2013
  11. Thomas RastNov 14, 2013
  12. Jeff KingNov 14, 2013
  13. Sitaram ChamartyNov 14, 2013
  14. Jeff KingNov 14, 2013
  15. Luca MilanesioNov 14, 2013
  16. Sitaram ChamartyNov 14, 2013
  17. Sitaram ChamartyNov 14, 2013
  18. Jeff KingNov 14, 2013
  19. Stephen BashNov 14, 2013
  20. Sitaram ChamartyNov 14, 2013
  21. Sitaram ChamartyNov 14, 2013

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.