如何在Mercurial中恢复已删除的文件(如果有的话)? [英] How can I recover a removed file in Mercurial (if at all)?

查看:64
本文介绍了如何在Mercurial中恢复已删除的文件(如果有的话)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

偶然地,通过使用GUI而不是CLI,我删除了Mercurial项目中的每个文件.

Accidentally, by using a GUI as opposed to CLI, I removed every file in a Mercurial project.

我通过还原正常"恢复了工作,丢失了一些工作,由于有了时间机器,我可以轻松地恢复工作.但是,是否有一种方法可以取消/取消删除此类文件?遍历手册和谷歌搜索,但看不到任何东西.有插件吗?

I recovered with Revert ok and lost some work, which as I have time machine I could easily get back. But is there a way of un-remove/undelete such files? Trawled through the manual and googled but cannot see anything. Any plugins?

我可能会在这里回答我自己的问题,但是文件已从目录中删除并且不在垃圾桶中以进行恢复,因此我假设删除是不可撤消的吗?

I am probably answering my own question here but the files were gone from the directory and were not in the trash to recover so I am assuming Remove is irrevocable?

p.s.我知道hg forgethg remove -Af会删除而不从目录中删除,但我的问题与我犯的错误有关,而不是冷静地思考操作.

p.s. I know that hg forget or hg remove -Af will remove without deleting from the directory but my question has to do with the error I made as opposed to cool thinking the action through.

推荐答案

首先,使用hg grep查找要恢复的已删除文件.该命令的输出将向您显示文件所在的最新修订版本以及已删除文件的路径. 其次,运行hg revert -r <revision number> <path to deleted file> 现在,已删除的文件将在您的工作副本中,可以重新提交回头文件.

First, use hg grep to find the deleted file you wish to recover. The output of this command will show you the last revision for which the file was present, and the path to the deleted file. Second, run hg revert -r <revision number> <path to deleted file> The deleted file will now be in your working copy, ready to be committed back into head.

这篇关于如何在Mercurial中恢复已删除的文件(如果有的话)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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