Search code examples
mercurial

Mercurial: roll back an "hg commit --amend".


I accidentally did a "hg commit --amend" instead of just a commit. How can I roll back the commit to before the amend?


Solution

  • NOTE: This answer is now deprecated. See the answer from @Sorina Sandu instead.


    See hg help commit, where it says:

    The --amend flag can be used to amend the parent of the working directory with a new commit that contains the changes in the parent in addition to those currently reported by "hg status", if there are any. The old commit is stored in a backup bundle in ".hg/strip-backup" (see "hg help bundle" and "hg help unbundle" on how to restore it).