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

Re: [RFC] undo and redo

From
KBKirby C. Bohling <kbohling@birddog.com>
Date
Aug 25, 2005, 19:59 UTC
Message-ID
<20050825195918.GD7461@birddog.com>
In-Reply-To
<20050825163201.GA3944@hpsvcnb.fc.hp.com>

On Thu, Aug 25, 2005 at 10:32:01AM -0600, Carl Baldwin wrote: <snip...>

Show 18 quoted lines
> Another example is if I'm working on a commit and suddenly get a
> brilliant idea for some easy modification that I want to make and commit
> by itself before making this commit.  I can do this easily with
> 
>         % git undo
>         % carefully make easy change
>         % git commit
>         % git redo
> 
> Having a light-weight alternative like this could make the difference
> between realizing the easy, brilliant idea and forgetting about it on
> the back burner because it was just too cumbersome to make the context
> switch.
> 
> The bottom line is that I don't argue against using the existing
> work-flows.  I hope to add the flexibility to use various work-flows to
> fit the job at hand.
> 
<snip...>

[Not much of a git user, but am evaluating it for possible future usage]...

Why not just save the changes to a file via a patch. Just like you would if you were sending a patch to someone else. I have the work flow you are talking about when I use CVS. I just create a patch, apply the patch in reverse (or run the command to get you a clean working tree in the SCM). Make my unrelated changes commit it. Then apply the patch, possibly resolve merge conflicts, and proceed with finishing my original work.

Assuming your patch creation and application tools capture all the meta-data the SCM has (which I believe git does), it's pretty simple to simulate what you want manaully. With only a handful of commands.

I see the appeal of not having manually deal with the files, but assuming you don't feel it's branch worthy, and you don't want to have it be something someone else can access externally, it doesn't seem like a feature I can't get almost as simply with existing git commands.

I guess my final question is what does undo/redo have over saving stuff away in a patch assuming that the patch captures all of the SCM meta-data (the add/move/remove file type commands). If git doesn't capture all the meta-data in a patch, it would seem better to make it do that and get this as a side-affect.

    Thanks,
        Kirby
Previous: Kalle ValoNext: Junio C Hamano
Message 13 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.