“git am --abort”长期被遗忘的补丁尝试让我倒退了四个星期
今天我尝试在 (Tortoise)git 中玩补丁,显然是使用 git 以来第二次:它抱怨我已经在打补丁了。
因此,我没有多想,就点击了“中止”,因为我不再关心旧的补丁尝试,现在我过去四个星期的所有提交都消失了。
发生了什么? git 怎么能这样对我呢? ;-)
(正如您在下面我自己的答案中看到的那样,至少我得到了我的提交。但是按照我的理解,工作副本中的更改永远消失了。对于任何单击“中止”的小说用户来说,这是非常严厉的一些很久以前的行为会在没有警告的情况下同时破坏当前的工作...我想 git 喜欢偶尔公正地对待它的名字;-))
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 on "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 ;-) )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Tortoisegit 运行了 git am --abort ,它运行了 git --reset hard 回到尝试第一个补丁之前的状态(四个星期前),从那时起所有提交然后看不见。 comp.version-control.git 早在 2009 年,他们就考虑改变这种行为。在任何情况下,它都可以像 这篇文章。
Tortoisegit ran a
git am --abort
, which ran agit --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.