I’ve just messed something up in Mercurial.
How do I back out the last change so that the codebase is clean – specifically so that if someone else does ‘hg pull’, they’ll have a working codebase?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Two ways:
hg rollbackas mentioned by Fred; if you’ve already pushed, too late.hg rollbackis only suitable for local use.hg strip(also as mentioned by Fred) works the same way and is (excepting its support for backing up) equivalent to doinghg rollbacka number of times, till you get back to that revision.hg backoutfor when you have already pushed and just want to revert the effects of the commit (if you’ve accidentally pushed out sensitive data, you’ll need to take more drastic measures, but if you just want it to work, use this).If the commit is not the last-committed revision, say so and we can get into deeper stuff (or search – it’s been answered before).