Posted in Uncategorized

Tip: Removing a changset from a Mercurial repository

Tip: Removing a changset from a Mercurial repository

The “rollback” command only removes the latest changeset, if you want to remove/undo multiple changesets (and all of their descendants) from a repository you can use the “strip” method that comes with the “Mq” extension:

Step 1 – Enable the Mq extension
The Mq extension is distributed with Mercurial so to enable it just edit ~/.hgrc (in windows: C:\Users\UserName\.hgrc) and add the following lines:


If you use TortoiseHg, then you can just open the settings page, and in the Extensions section enable “mq”.

Step 2 – Remove a changeset
Find the revision number of the changeset you wish to remove (via TortoiseHg or “hg log”) and execute the following command:

  > hg strip revision-number

If you mess up you can restore the changeset by running:

  > hg unbundle .hg/strip-backup/filename

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s