Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rollback to committed and pushed revision in mercurial?

I made a mistake and removed a file. I'd like to go back to my previous commit! I tried with revert and backout with had no luck...

Any tip?

Edit: I did exactly this:

hg forget file
hg commit -m "Blah"
hg push

The revision number of this last push is 17.

Now file is not tracked anymore. I'd like to get it back to revision 15 (not the inmediate previous rev, but one extra step back) as i do not want to keep working on the file in rev 16.

like image 800
Gabriel Avatar asked Oct 26 '10 02:10

Gabriel


People also ask

How do you revert push changes in Mercurial?

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 .

How do you undo a pull in Mercurial?

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.

What is backout in Mercurial?

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.


Video Answer


1 Answers

Found a solution:

hg revert file -r15 //(reverts file to revision 15).
like image 101
Gabriel Avatar answered Sep 21 '22 15:09

Gabriel