如何查找和恢复已删除的文件 [英] How to locate and recover a deleted file
本文介绍了如何查找和恢复已删除的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在过去的某个阶段,我有一个"foo.txt",该文件受Mercurial源代码控制.但是,现在它已被删除.
At some stage in the past I had a "foo.txt" which was under Mercurial source control. However it has now been deleted.
当我不知道删除文件的最新Mercurial版本时,如何恢复文件?
How can I recover the file when I don't know the last Mercurial revision in which the file was deleted?
推荐答案
如果知道文件的确切路径,则可以执行以下操作:
If you know the exact path for the file, you can do something like :
hg log -l 1 path/to/foo.txt
这将向您显示修改foo.txt
的最后一个变更集,因此您将能够从此修订版本还原文件.
This will show you the last changeset where foo.txt
was modified, so you will be able to restore the file from this revision.
一旦您具有正确的修订版,您就可以轻松完成:
Once you have the right revision, you can simply do :
hg revert -r <my revision> path/to/foo.txt
hg commit -m "add the foo.txt file again"
这篇关于如何查找和恢复已删除的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文