Hypercube
Hypercube

Reputation: 1193

Mercurial pushing update to previous revision

I ran hg update -r REVISION to revert a branch to a previous revision, but when I try to push this to a remote repository it says "no changes found". How can I accomplish this?

Upvotes: 2

Views: 242

Answers (2)

Ned Deily
Ned Deily

Reputation: 85105

hg update only affects the state of your working directory, not the repository itself. If you want to "undo" the effects of one or more previous revisions, you will need to change the repository by committing a new changeset that reflects those changes. You could do it manually but hg's builtin backout command makes this easy to do. See a brief description here. There is a detailed explanation of backout here.

Upvotes: 1

Faheem Mitha
Faheem Mitha

Reputation: 6326

To revert the files to a previous revision you can use

hg revert -r REVISION

This will change your working directory files to what they were at that revison. Then you will need to commit these changes before pushing.

hg update -r REVISION changes the working directory's parent to be that revision as well as changes the contents of the working directory to that revision. This is not what you want here.

Upvotes: 4

Related Questions