How to locate and recover a deleted file

偶尔善良 提交于 2019-12-03 09:48:25

If you know the exact path for the file, you can do something like :

hg log -l 1 path/to/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"

Using revsets:

hg log -r "removes('path_to_file')"

Where path_to_file can be anything documented in hg help patterns, including an exact path, a glob or a regular expression.

Edit: Incorporated Brian's comment about putting path_to_file in single quotes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!