Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I started down a new branch of development and decided that some files needed to go.

Several commits later I realise that a certain decision was wrong and I need a couple of the files back.

My initial thought of how to get the files back is to just take copies from the other branch and commit them to the head of the new branch, but I worry that this means that the files won't be associated with their old history.

Is there a way to do this that keeps the history intact?

I'm using mercurial version 1.5.2

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I found this solution on another website, but I can't find where.

The answer is to revert the files that were deleted individually:

hg revert -rxxx filename

where xxx is the revision number of before the delete.

Then commit them back in. The history is preserved!

share|improve this answer
    
This gives exactly the same result as copying the file. –  tonfa Apr 14 '11 at 20:39
    
@tonfa: thanks, I guess I was overthinking things :D –  Matt Ellen Apr 14 '11 at 20:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.