Search code examples
mercurialundomercurial-queuebackout

How to undo "hg qnew"?


I issued hg qnew without realizing that it includes any outstanding changes into the patch. I'd like to back that out and pick only specific changes using hg qrecord. How can I undo qnew?


Solution

  • Your answer definitely works — with newer Mercurial's you can use hg strip --keep to avoid doing the import step:

    $ hg strip --keep .
    $ hg qdelete patch-name
    

    The --keep flag makes strip ignore the working copy while working, that is, it deletes the commit (like hg qpop would do) but it doesn't undo the changes to the files. After stripping you still have the patch in your series (unapplied) and you can then delete it.