Delete all local changesets and revert to tree

后端 未结 7 620
小蘑菇
小蘑菇 2021-01-29 20:25

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

相关标签:
7条回答
  • 2021-01-29 21:19

    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())'
    
    0 讨论(0)
提交回复
热议问题