Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hg strip vs hg backout and hg revert

What is the difference between the mercurial commands,

  • hg strip
  • hg backout
  • hg revert

All these commands basically are used to revert/undo the effects of an earlier changeset.

like image 322
Gopinagh.R Avatar asked Jan 04 '13 05:01

Gopinagh.R


People also ask

What is hg backout?

hg backout [OPTION]... [- r] REV. Revert/undo the effect of an earlier changeset.

How do I revert a changeset in Mercurial?

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 . This will revert the file without committing it.

How do I undo a commit in Mercurial?

You can manually trigger a rollback with 'hg rollback'. This will undo the last transactional command. If a pull command brought 10 new changesets into the repository on different branches, then ' hg rollback ' will remove them all. Please note: there is no backup when you rollback a transaction!


1 Answers

hg strip removes the changeset and all its descendants from the repository. It will be as if the changes never existed. Be careful when using this on public changesets as it will not remove it from any other repository and you'll get them back next time you pull.

hg backout creates a new changeset to reverse the effect of an earlier changeset. The old changeset will still remain in the repository but so will a new changeset to remove the changes.

hg revert with a revision updates the working copy to the specified revision. If you then commit that working copy it will have the effect of reverting all changes since.

Other answers with more info on revert and backout:

  • What is the difference between hg revert and hg backout?.
  • Mercurial — revert back to old version and continue from there.
like image 194
Steve Kaye Avatar answered Sep 30 '22 19:09

Steve Kaye