Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove a revision in TortoiseHG and Mercurial

In my repository I needed to revert to an older revision. I did reverting and made the changes I needed to. How do I push the new revision upstream?

I was on rev 17 when I needed to revert back to rev 13. Now that I've made my changes, I'm on rev 18. Thing is, when I go to push these changes up (I'm using TortoiseHG), I get an error "abort:push create new remote head.

I don't want to do a merge. Do I want to do a force with the --force command or do I need to delete rev 14-17. If I need to delete, how do I delete 14-17.?

like image 519
jvcoach23 Avatar asked Aug 14 '12 18:08

jvcoach23


People also ask

How do I undo a commit in Mercurial?

If you want to revert changes already committed: To backout a specific changeset use hg backout -r CHANGESET . This will prompt you directly with a request for the commit message to use in the backout. To revert a file to a specific changeset, use hg revert -r CHANGESET FILENAME .

How do I revert a commit in TortoiseHg?

In the TortoiseHg client's Commit dialog, right-click the needed file and then click Revert.


2 Answers

Proper solution is to actually merge with option Discard all changes from merge target (other) revision. But sometimes life is harder on us and we really need to drop some changes (eg. we committed nuclear launch codes or some other security sensitive data). Is that your case? If yes then follow.

Assuming that original changes were not published you could:

  • enable mq extension
  • r-click on offending changes and execute Modify history->Strip. This will permanently remove changes from your local history.
like image 128
Michal Sznajder Avatar answered Sep 21 '22 17:09

Michal Sznajder


You don't want to delete revisions and therefore destroy history. That goes against the reason version control exists.

You can do a merge and discard.

You can also do this in tortoiseHG.

enter image description here

like image 23
bvulaj Avatar answered Sep 22 '22 17:09

bvulaj