How to Hg Shelve Added files uncommitted yet

latvian picture latvian · Nov 1, 2012 · Viewed 8k times · Source

I am using Mercurial Shelve extension to shelve changes from command line. It works nice except when the changes that i like to shelve contain new added files(a) in working directory. Basically, it shelves everything except the new added files. I checked this by looking at the .hg/shelve stored changes.

How to shelve new added files (a status)?

Answer

Samuel Dauzon picture Samuel Dauzon · Oct 8, 2015

This response is overdue, but you can use the following command to shelve all files (track / untrack) :

hg shelve -A

or

hg shelve --addremove

About this command, documentation says :

mark new/missing files as added/removed before shelving

You must pay attention by using this feature because after unshelving, your old untracked files are track. These file are already to be commited in the last commit if no files are specified in hg commit command. You should use hg forget if you want untracked them again.