How to undo a Mercurial update

Viewed 87

I was working in a Mercurial branch which had about 10 file changes in the working directory. The working directory's parent was the tip of the branch. Then I updated to a much older change set in the same branch forgetting that I had the 10 changes in the working directory. Now I have hundreds of changes in the working directory and I have no idea what the 10 changes were that I started with. Is there any way to undo the update to the older change set and get back to the state where I had just the 10 changes in my working directory?

To complicate matters, I control-c'd the update when beyond compare popped up asking me to merge a conflict.

I made a mess.

1 Answers

Look for files with names ending in .orig in your working directory. Those are backups for the original version.

Unfortunately this is a place where mercurial's UI is not very safe by default. I'd suggest adding an alias either overriding the default behavior of hg update or adding an alias that does hg update --check, which would have avoided this.

Related