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