Search code examples
mercurialtortoisehgchangeset

Is there a way in Mercurial/TortoiseHg to remove a changeset while keeping its changes in the working copy?


Like the title says. I essentially want a way to make Mercurial "forget" a changeset in the local repository. Obviously, this would only work for changesets which had not been pushed without also reverting the original changeset.


Solution

  • Mercurial doesn't make forgetting anything easy -- no commands that are destructive of history are enabled by default. Without enabling any extensions the easiest way to do this would be:

    hg clone -U -r LAST_CHANGE_YOU_WANT your-repo new-repo
    

    and then replace the .hg in your-repo with the one from new-repo.