简体   繁体   中英

Mercurial/Kiln how can I get a deleted file without affecting my other files?

I have a file that was deleted a few changesets ago. As you can imagine, the other files in my project have changed since then. How can I get back that file (it's actually 2 files) without reverting all the other source files?

Use hg revert for just that file:

hg revert -r REV path/to/deleted/file

From the help for hg revert

If a file has been deleted, it is restored. If the executable mode of a file was changed, it is reset.

If names are given, all files matching the names are reverted. If no arguments are given, no files are reverted.

Another approach to this is to use the Kiln website. You can search for a changeset by changeset id, or just use a date search, .eg date:2011-10-01..2011-10-31

That will then give you a list of changesets, click the one that will show the version of the code you want to recover, and then if you click the Browse files at [changeset id] link on the right hand side you will then get a list of the folders and files at that point in time.

You can then just add new files to your project and cut and paste the code back into those new files.

Admittedly this isn't as nice an approach for recovering a whole file, but it's handy if you only want to recover part of the code, or if someone has subsequently added a new file with the name of the old file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM