Sevenforge Sevenforge by Curtis Spencer home

Stripping a Bad Revision from Mercurial

October 21, 2009

Sometimes you do a hg addremove; hg ci; hg push; when you aren't really thinking. Here is the antidote.

$hg --config strip bad_revision_num

This hg command will strip the bad_revision_num and every consequent revision. If other developers have started pushing onto your bad repository, it is an even bigger headache to strip that bad revision and keep the future ones. I haven't ran into that problem just yet, but I imagine a little work with turning the revisions into patches and applying the cherry picked patches would be one option.

Fork me on GitHub