Alex Rivera | Logout

Mercurial: How do you undo changes?

Asked 2010-07-09T15:22:21.150
69

When using Mercurial, how do you undo all changes in the working directory since the last commit? It seems like this would be a simple thing, but it's escaping me.

For example, let's say I have 4 commits. Then, I make some changes to my code. Then I decide that my changes are bad and I just want to go back to the state of the code at my last commit. So, I think I should do:

hg update 4

with 4 being the revision # of my latest commit. But, Mercurial doesn't change any of the files in my working directory. Why not?

Edit
Report

1 Answer

3
hg revert --all 

and then

hg pull -u 

works for me

answered 2013-01-30T02:49:03.250

Your Answer