Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have a handful options:</p> <ol> <li><p><a href="https://www.mercurial-scm.org/wiki/ShelveExtension">Shelve</a> the items. This saves the changes and removes them from the working directory so the branch can continue. It doesn't create a change-set.</p> <pre><code>hg shelve --all --name "UnfinishedChanges" hg unshelve --name "UnfinishedChanges" </code></pre> <p><strong>Update/Edit</strong>: Newer versions of mercurial may need to use</p> <pre><code>hg shelve -n "UnfinishedChanges" hg unshelve "UnfinishedChanges" </code></pre> <p>You can still use <code>--name</code> as an alternative to <code>-n</code>, but mercurial doesn't seem to like <code>--name</code> anymore. Additionally, the <code>--all</code> is no longer required and mercurial will in fact freak out over it. </p></li> <li><p><a href="https://www.mercurial-scm.org/wiki/MqExtension/">Patch queue</a> the items using <code>mq</code>. This isn't too dissimilar to shelve in some respects, but behaves differently. The end result is the same, changes are removed and can be optionally re-applied later. When pushed, the patches are logical change-sets, when popped they are saved elsewhere and are not part of change-set history.</p> <pre><code>hg qnew "UnfinishedWork" hg qrefresh hg qpop hg qpush "UnfinishedWork" </code></pre></li> <li><p>Commit them locally, update to the previous change-set and continue working and make use of anonymous branches (or multiple heads). If you then want the changes, you can merge heads. If you don't want the changes, you can <a href="https://www.mercurial-scm.org/wiki/StripExtension">strip</a> the change-set.</p> <pre><code>hg commit -m"Commiting unfinished work in-line." hg update -r&lt;previous revision&gt; hg strip -r&lt;revision of temporary commit&gt; </code></pre></li> <li><p>Commit them to a named branch. The workflow then becomes the same as option 3 - merge or strip when you are ready.</p> <pre><code>hg branch "NewBranch" hg commit -m"Commiting unfinished work to temporary named branch." hg update &lt;previous branch name&gt; </code></pre></li> </ol> <p>Personally I use option 3 or 4 as I don't mind stripping change-sets or checking-in partial code (so long as that doesn't eventually get pushed). This can be used in conjunction with the new <a href="https://www.mercurial-scm.org/wiki/Phases">Phase</a> stuff to hide your local change-sets from other users if need-be.</p> <p>I also use the <code>rebase</code> command to move change-sets around to avoid merges where a merge wouldn't add anything to the history of the code. Merges I tend to save for activity between important branches (such as release branches), or activity from a longer-lived feature branch. There is also the <code>histedit</code> command I use for compressing change-sets where the "chattiness" of them reduces the value.</p> <p>Patch queues are also a common mechanism for doing this, but they have stack semantics. You push and pop patches, but a patch that is "underneath" another patch in the stack requires that the one on top of it be pushed also.</p> <p><strong>Warning</strong>, as with all these options, if the files have more changes since the temporary changes that you've shelved / queued / branched, there will be merge resolution required when un-shelving / pushing / merging.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload