hg equivalent of git stash
Masklinn
masklinn at masklinn.net
Mon Dec 12 15:35:18 UTC 2011
On 2011-12-12, at 16:15 , anatoly techtonik wrote:
> Quoting http://markmail.org/message/lglewvoffuxnffbz
> On Jan 12, 2008 3:27:01 pm, Matt Mackall wrote:
>> On Sat, 2008-01-12 at 17:13 -0600, Phillip Koebbe wrote:
>>> I was reading earlier today about "git stash" and was thinking it
>>> would be very useful to me. Is something like that available in hg?
>> You might be interested in mq, which is about a million times more
>> useful.
> Among million use cases for mq, can anybody explain the mq equivalent of
> git stash?
>
> My use case: I want to put my current changes away temporarily (into
> stash), do some unrelated changes, commit them and then get my previous
> changes back (removing them from stash). How do I do this with mq?
> hg qnew -f [-i] [-m "reminder message"] some-patch-name [files…]
> hg qpop
will put your changes (potentially filtered by -i or the files list) in your queue, and then "pop" (unapply and store) these changes
To reintroduce them, `hg qpush` will "push" (apply) these changes. The "drawback" for a shelve scenario is that these changes are already in the form of a revision at this point, you can either finish the changes within mq (using `hg qrefresh` to update it and `hq qfinish` to serialize it into an hg revision living outside of MQ) or strip out the revision keeping the patch data via `hg strip -k`.
Alternatively, there are third-party shelve extensions which provide a simpler workflow for shelving: Attic[0] and Shelve[1]. As far as I can see, Attic is not maintained anymore so I'd suggest going with shelve.
[0] http://mercurial.selenic.com/wiki/AtticExtension
[1] http://mercurial.selenic.com/wiki/ShelveExtension
More information about the Mercurial
mailing list