如何从 Mercurial .hg/store/data/ 恢复文件
我有一个文件 main.py 已提交给 Mercurial,但随后意外恢复并删除。
我注意到存在一个二进制文件 .hg/store/data/main.py.i 是否可以从中恢复原始文件?
I had a file main.py that was committed to mercurial but then accidentally reverted and deleted.
I notice a binary file exists .hg/store/data/main.py.i
Is it possible to restore the original file from this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不幸的是,正如我在邮件列表中所说,不可能撤消这样的删除或恢复。
hg update 命令
的-C
选项明确表示:因此对该文件的更改将丢失。
您可以做的是从特定修订版中获取文件,但在我看来,您对文件进行了未提交的更改,并且更改和/或文件已被完全删除。
Unfortunately, as I said on the mailing list, it is not possible to undo a deletion or revertion like that.
The
-C
option to thehg update command
says specifically:So the changes to that file is lost.
What you can do is get the file out from a specific revision, but it sounds to me as you had uncommitted changes to the file and the changes and/or file was completely deleted.
您可以使用 hg revert -r恢复文件的任何版本文件名。
You can restore any version of a file with
hg revert -r <revision-where-the-file-existed> file.name
.我发现该文件保存在另一个头中:
I found the file was maintained in another head: