hg shelve equivalent of git stash drop

14,188

Solution 1

The Mercurial shelve extension stores patches under .hg/shelved. Each is a simple patch file, and the filename is the name of the patch. So to remove a patch called 'mypatch' I can simply remove the file 'mypatch' from .hg/shelved:

rm .hg/shelved/mypatch

Solution 2

From the Mercurial shelve documentation (or using hg help shelve):

To delete specific shelved changes, use "--delete". To delete all shelved changes, use "--cleanup".

options:

-d --delete delete the named shelved change(s)

So if your patch was called my-patch, then you would delete it using:

hg shelve -d my-patch

Solution 3

If you don't want to use shelves, you can do it the following way.

hg diff > mylocalchanges.txt
hg revert -a
# Do your merge here, once you are done, import back your local mods
hg import --no-commit mylocalchanges.txt
Share:
14,188
undefined
Author by

undefined

Updated on June 05, 2022

Comments

  • undefined
    undefined about 2 years

    I have the hg shelve (not attic) extension installed, and I want to drop a patch. In git it would be git stash drop. How do I do this using the shelve extension?

  • cn007b
    cn007b over 8 years
    To avoid creation *.orig files use: hg revert -aC
  • ForeverWintr
    ForeverWintr over 7 years
    See BennyMcBenBen's answer for a way to remove shelves using the hg shelve UI.