Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Hg Shelve Added files uncommitted yet

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)?

like image 337
latvian Avatar asked Nov 01 '12 16:11

latvian


People also ask

What is HG shelve?

Description. The "hg shelve" command saves changes made to the working directory and reverts those changes, resetting the working directory to a clean state. Later on, the "hg unshelve" command restores the changes saved by "hg shelve".

How do you shelve changes?

Shelve changesIn the Commit tool window Alt+0 , right-click the files or the changelist you want to put to a shelf and select Shelve changes from the context menu. In the Shelve Changes dialog, review the list of modified files.

What is shelf in git?

The term 'shelve' references a commonly understood process that takes some temporary file changes, saves them locally and outside of the current version control system and then returns to those files at some point in the future. This concept is built right into the Git tool, but it's not named shelve.


3 Answers

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.

like image 165
Samuel Dauzon Avatar answered Oct 18 '22 22:10

Samuel Dauzon


I assume you are talking about currently untracked files? You need to add the first.

So just do hg add for your new files and then hg shelve will also shelve them.

like image 35
Chronial Avatar answered Oct 18 '22 21:10

Chronial


Thank you Tom. I am using Mac, so it didn't really worked. What did work was another mercurial extension 'hgattic' about which you can read more in my blog

http://margotskapacs.com/2012/10/shelving-uncommitted-changes-in-mercurial/

(see section 'Bug – Added Files Unable Shelve')

like image 4
latvian Avatar answered Oct 18 '22 20:10

latvian