I\'m using Mercurial and I\'ve got into a terrible mess locally, with three heads. I can\'t push, and I just want to delete all my local changes and commits and start again with
When the simplest way (a new hg clone
) isn't practical, I use hg strip
:
% hg outgoing -l 1
% hg strip $rev # replace $rev with the revision number from outgoing
Repeat until hg outgoing
stays quiet. Note that hg strip $rev
obliterates $rev
and all its descendants.
Note that you may have to first enable strip in your Mercurial settings.
PS: an even smarter approach is to use the revset language, and do:
% hg strip 'roots(outgoing())'