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

Re: Reverting an uncommitted revert

From
Nicolas Pitre <nico@cam.org>
Date
May 20, 2009, 18:04 UTC
Message-ID
<alpine.LFD.2.00.0905201358000.3906@xanadu.home>
In-Reply-To
<20090520165854.GA23031@coredump.intra.peff.net>
On Wed, 20 May 2009, Jeff King wrote:
Show 22 quoted lines
> On Wed, May 20, 2009 at 06:13:55PM +0200, Sverre Rabbelier wrote:
> 
> > On that note, the usefulness of such a feature is dependant on the
> > support we have for actually restoring an entry from this new reflog.
> > The current reflog is so amazingly useful because git has
> > awesome-cherry-pick-and-the-like-commit-handling powers that make it
> > easy to restore the otherwise lost state. But as far as I know,
> > there's no nice 'n easy support for restoring state to the information
> > contained in this new reflog, is there?
> 
> I was envisioning a reflog of tree objects, so you could do:
> 
>   $ git reflog show TRASH ;# show the reflog message
>   $ git show TRASH@{1} ;# show what's in the tree
>   $ git show TRASH@{1}:path/to/file ;# see a file
>   $ git checkout TRASH@{1} path/to/file ;# restore a file
> 
> which should all work as-is.
> 
> I suspect "git log -g" might need some tweaking to get a tree rather
> than a commit (but in theory we should just show the "Reflog *:" headers
> and not the commit headers).

Even simpler (for the user) would be to create a full commit with a synthetic message. The advantage is that the commit would have for parent the HEAD commit at the moment the operation leading to the reflog entry was made, with the date tag, etc. The message could even contain information about what exactly was discarded by the operation. This commit would be referenced only by the trash reflog and not be part of any branch. And all your examples above should still work of course.

Nicolas
Previous: Jeff KingNext: Sverre Rabbelier
Message 22 of 28 in “Reverting an uncommitted revert”
  1. Joshua JensenMay 20, 2009
  2. Nicolas PitreMay 20, 2009
  3. Jeff KingMay 20, 2009
  4. Nicolas PitreMay 20, 2009
  5. Jeff KingMay 20, 2009
  6. Ping YinMay 20, 2009
  7. Wincent ColaiutaMay 20, 2009
  8. Jakub NarebskiMay 20, 2009
  9. Nicolas PitreMay 20, 2009
  10. Shawn O. PearceMay 20, 2009
  11. Eric RaibleMay 20, 2009
  12. Junio C HamanoMay 20, 2009
  13. Nicolas PitreMay 20, 2009
  14. Nicolas PitreMay 20, 2009
  15. Shawn O. PearceMay 20, 2009
  16. Junio C HamanoMay 21, 2009
  17. Jakub NarebskiMay 20, 2009
  18. Wincent ColaiutaMay 20, 2009
  19. Nicolas PitreMay 20, 2009
  20. Sverre RabbelierMay 20, 2009
  21. Jeff KingMay 20, 2009
  22. Nicolas PitreMay 20, 2009
  23. Sverre RabbelierMay 20, 2009
  24. Jeff KingMay 21, 2009
  25. Junio C HamanoMay 20, 2009
  26. write-tree --ignore-cache-treeJunio C Hamano, May 20, 2009
  27. 1/2 cache-tree.c::cache_tree_find(): simplify inernal APIJunio C Hamano, May 21, 2009
  28. 2/2 Optimize "diff-index --cached" using cache-treeJunio C Hamano, May 21, 2009

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.