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

Re: [RFC] undo and redo

From
Junio C Hamano <junkio@cox.net>
Date
Aug 24, 2005, 22:48 UTC
Message-ID
<7vd5o3ar4a.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0508241651420.23242@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
> Generally, each subdirectory of refs/ has refs to objects of the same
> type, and heads/ is commits, but other directories are other things. tags/
> is all tag objects, and you could have undo/ be trees.

That's OK from the prune front, but I am not sure what the ramifications of this for pulling, pushing, and resolving. I would not recommend it without really thinking it through.

Also note that tags/ is not all tag objects. I think "git tag" by default creates a lightweight tag, not an annotated kind.

I think you could do either one of two things. As usual, totally untested. Just thinking aloud.

(1) A hack.
     - Have a single "undo-redo" branch, which was forked from
       somewhere on the "master" branch.
     - When doing "undo", make a commit that has the current top
       of undo-redo branch as the first parent and the current
       HEAD commit as the second parent, using the tree that
       represents your snapshot, to grow "undo-redo" branch.
       No, this commit does *not* represent a merge, but I am
       abusing the capability to record more than one parent
       commits.
     - When running "redo", you would want a handy way to name
       what to redo.  You can say "undo-redo~N" to mean "Nth
       from the top of undo-redo branch.
       Your implementation of "redo" can either be (patch way):
       git-diff-tree -p undo-redo~N^ undo-redo~N | git apply --index
       or (merge way):
       git-read-tree -m undo-redo~N^2 undo-redo~N HEAD &&
       git-merge-cache -o git-merge-one-file-script -a
(2) Try StGIT.
Previous: Daniel BarkalowNext: Carl Baldwin
Message 8 of 21 in “[RFC] undo and redo”
  1. Carl BaldwinAug 24, 2005
  2. Carl BaldwinAug 24, 2005
  3. Linus TorvaldsAug 24, 2005
  4. Carl BaldwinAug 24, 2005
  5. Daniel BarkalowAug 24, 2005
  6. Carl BaldwinAug 24, 2005
  7. Daniel BarkalowAug 24, 2005
  8. Junio C HamanoAug 24, 2005
  9. Carl BaldwinAug 25, 2005
  10. Junio C HamanoAug 25, 2005
  11. Carl BaldwinAug 25, 2005
  12. Kalle ValoAug 25, 2005
  13. Kirby C. BohlingAug 25, 2005
  14. Junio C HamanoAug 25, 2005
  15. Kirby C. BohlingAug 25, 2005
  16. Carl BaldwinAug 25, 2005
  17. Carl BaldwinAug 25, 2005
  18. Kirby C. BohlingAug 25, 2005
  19. Carl BaldwinAug 25, 2005
  20. Junio C HamanoAug 24, 2005
  21. Carl BaldwinAug 24, 2005

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.