如何在Windows上的Git Gui或Gitk中撤消硬重置? [英] How do you undo a hard reset in Git Gui or Gitk on Windows?

查看:572
本文介绍了如何在Windows上的Git Gui或Gitk中撤消硬重置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上使用Git Gui和Gitk。如何在过去两个小时内撤销硬重置?



(是否可以在不使用命令行的情况下从这些应用程序执行此操作?)

>

我看到这个SO帖子,这说明在git的垃圾收集发生之前可以使用undos。我可能已经退出并重新打开这些应用程序中的一个或两个。 解决方案

请参阅Brian Riehman和Pat Notz在答案中的答案在问题中。



一个解决方案是使用命令行。



在Windows中,在包含 .git 目录。



输入如下所示的内容:

 c:\程序文件\Git\bin\git.exereflog 

要进入某个提交,请输入如下所示的内容,其中最后一个表达式是该提交的SHA1代码:

 c:\程序文件\Git\bin\git.exereset --hard 5eb4080 


I'm using Git Gui and Gitk on Windows. How do I undo a hard reset from within the past two hours?

(Is it possible to do this from these applications, without using the command line?)

I saw this SO post, which says that undos are possible before git's garbage collection occurs. I might have quit and reopened one or both of these applications.

解决方案

See the answers by Brian Riehman and Pat Notz in the link in the question.

One solution is to use the command line.

In Windows, open DOS in the directory containing your .git directory.

Type something like the following to see what commit you want to go to:

"c:\Program Files\Git\bin\git.exe" reflog

To go to a certain commit, type something like the following, where the last expression is the SHA1 code of that commit:

"c:\Program Files\Git\bin\git.exe" reset --hard 5eb4080

这篇关于如何在Windows上的Git Gui或Gitk中撤消硬重置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆