I have a HG repository with revs 1, 2, 3, 4, 5 and 6.
When I committed rev 4, I unknowingly botched some changes in rev3 that I should not have. I did not notice this until rev 6 was already committed.
I need to undo changes in rev 4, but then re-apply all other changes after that. Basically undoing commit #4. How can I do that?
If you want to revert just the latest commit use: hg strip --keep -r . Using strip will revert the state of your files to the specified commit but you will have them as pending changes, so you can apply them together with your file to a new commit.
There is only one level of rollback, and there is no way to undo a rollback. It will also restore the dirstate at the time of the last transaction, losing any dirstate changes since that time. This command does not alter the working directory.
You need to login to the server and use the hg strip command. If you cannot login to the server, you are out of luck; you can hg backout then push again, but this will leave the bad commits on the server along with the commit that undoes them. Show activity on this post. hg revert -r .
You want hg backout
Revert/undo the effect of an earlier changeset...
Backout works by applying a changeset that's the opposite of the changeset to be backed out. That new changeset is committed to the repository, and eventually merged...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With