hg strip vs hg backout and hg revert
Asked Answered
C

2

85

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.

Chlodwig answered 4/1, 2013 at 5:38 Comment(1)
See also #13763534Jonathonjonati
D
111

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:

Delainedelainey answered 4/1, 2013 at 11:35 Comment(2)
Hi, will hg backout revert the file add/remove which has happened in wrong merge which I'm doing backout? Btw, I have tried and found the new files remain in repoVellicate
When dealing with UNPUSHED changesets I cannot see a difference between "hg strip --keep tip" and "hg backout" (tried with Mercurial 4.5.2) -- both remove the most recent changeset/commit and preserve changesOtology
T
0

At certain moment of time I had to build Jenkins pipeline where POM files should be reverted each time the job starts. And the problem which I have faced is: how to revert all POM files reversively.

Since this answer is one of the first on google, I want to contribute my solution for people with same problem

hg revert */pom.xml
Tiana answered 19/11, 2018 at 10:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.