Friday, February 03, 2012

Delete local commits in Mercurial

I've faced a problem in mercurial source control, simply i've added some commits and discovered that they are unwanted to be pushed.
A simple way to find is the command STRIP. Strip required to install mqExtension to mercurial to enable it.
To install and configure it look here http://mercurial.selenic.com/wiki/MqExtension#Configuration

Then use the following command
hg strip changeset
Where changeset is the hash of the commit you want to delete
Use hg -v help strip changeset to view detailed options of the command.
Note: deleting any changeset will delete all its children. By default strip takes a backup of the deleted changeset.