hg strip vs hg backout and hg revert

Gopinagh.R picture Gopinagh.R · Jan 4, 2013 · Viewed 45.4k times · Source

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.

Answer

Steve Kaye picture Steve Kaye · Jan 4, 2013

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: