I tried to play with patches in (Tortoise)git today, apparently for the second time since using git: it complained that I was already in the middle of patching.
So without much thinking, I clicked o开发者_Python百科n "abort" since I didn't care about the old patch-attempt any more, and now all my commits of the last four weeks are gone.
What happened? How can git do this to me? ;-)
(as you can see in my own answer below, at least I got my commits back. But changes in the working copy are gone forever, the way I understand it. Quite harsh to any novel user that clicking "Abort" on some far-ago action will at the same time destroy current work without warning... I guess git likes to do its name justice once in a while ;-) )
Tortoisegit ran a git am --abort
, which ran a git --reset hard
back to the state before attempting the first patch (four weeks ago), making all commits since then invisible. There was a discussion about this on comp.version-control.git back in 2009, where they were thinking about changing the behavior. In any case, it can be undone like any --reset hard
as described in this SO post.
精彩评论