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

Implicit stashes

From
John Tapsell <johnflux@gmail.com>
Date
Jun 30, 2010, 02:48 UTC
Message-ID
<AANLkTilTaQP6qARY1A495vm9HAvLVX_lqIQd1l3WIv7a@mail.gmail.com>
Hi,
  I was thinking that it would be nice if everything was undoable in
git.  Currently there are some easily typed by irreversible commands
that I keep seeing people doing.
For example:
$ git checkout folder
Now all changes that you just worked on are deleted, with no way of recovering.
$ git reset --hard

I know this seems very explicit to delete changes, but I myself have done this and accidentally lost changes. For example, I write a unit test and don't commit it in on purpose because I know that it currently fails and I want to test it against older versions. I carefully git checkout older versions to find if the unit test fails, then in stupidity reset back to origin/master ..

  Anyway, I think a nice solution is to have a separate stash for
implicit stashes.  Then irreversible commands would simply stash
before making the changes.
  It would also be nice to add a 'git undo' which just undoes whatever
the last operation was - i.e  unstash or reset to an earlier HEAD@{1}
John
Next: Joshua Jensen
Message 1 of 8 in “Implicit stashes”
  1. John TapsellJun 30, 2010
  2. Joshua JensenJun 30, 2010
  3. John TapsellJun 30, 2010
  4. Sverre RabbelierJun 30, 2010
  5. AlexJun 30, 2010
  6. Dangers of reset --hard (Re: Implicit stashes)Jonathan Nieder, Jun 30, 2010
  7. Will PalmerJun 30, 2010
  8. Jonathan NiederJun 30, 2010

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.