14

I have a commit on a public repository. I would like this commit to not be there (I've moved that work off to a branch), I obviously don't want to destroy the branch history, basically just do an inverse of that commit. In git this is just git revert, but I'm not using git :)

Niall C.
  • 10,878
  • 7
  • 69
  • 61
Alex Gaynor
  • 14,353
  • 9
  • 63
  • 113

1 Answers1

16

hg backout

hg backout [OPTION]... [-r] REV

reverse effect of earlier changeset

Commit the backed out changes as a new changeset. The new
changeset is a child of the backed out changeset.

If you backout a changeset other than the tip, a new head is
created. This head will be the new tip and you should merge this
backout changeset with another head.
Ben Jackson
  • 90,079
  • 9
  • 98
  • 150
  • Is there a way to make this work with a revision that was created via `hg commit --amend`? I get this error: "abort: cannot backout change that is not an ancestor" – Dan Dec 07 '22 at 02:57