hg equivalent of git stash

Frank Kingswood frank at kingswood-consulting.co.uk
Tue Dec 13 03:04:39 UTC 2011


On 13/12/11 05:56, anatoly techtonik wrote:
> On Mon, Dec 12, 2011 at 8:51 PM, Masklinn <masklinn at masklinn.net
> <mailto:masklinn at masklinn.net>> wrote:
>
>     On 2011-12-12, at 18:27 , anatoly techtonik wrote:
>      >> hg qpush
>      >> hg qfinish
>      > abort: no revisions specified
>      >
>      > It is not clear which revisions should I (as a user) specify.
>     either `tip`, or just use the `-a` flag to finish "all applied
>     patches" (there's only one).
>
>      > I understand
>      > that I should commit with 'qfinish' first to be able to do 'hg
>     strip -k'
>      > after.
>     It's not necessary.
>
>
> Let's summarize this another way:
> # stashing
> git> git stash save "work in progress"
> hg> hg qnew stash-work-in-progress
> hg> hg qpop
>
> # restoring
> git> git stash apply
> hg> hg qpush
> hg> hg qfinish tip
> patch stash-work-in-progress finalized without changeset message
> hg> hg strip -k tip

It's not clear why you would qpush, qfinish and immediately strip -k it.

If you want to work on it just
	$ hg qpush
	[work]
	$ hg qdiff   # show current changes including the stacked ones

to save your work in progress and do something else temporarily again:
	$ hg qrefresh   # save my changes
	$ hg qpop

Note that you can pull and update to a different revision between qpop 
and qpush to rebase your changes on top of the new revision.

If you want to delete the changes then
	$ hg qdelete stash-work-in-progress

> Not very intuitive either, but at least easier to remember. This
> solution is better in a way that it doesn't require me to remember the
> name of the patch with stash, but worse, because I can forget to specify
> -k argument one day and lose changes. I also did not understand how can
> it be so that it is not necessary to do `qfinish` before `strip -k`?
>  From what I can see `strip` doesn't work with queues.

It just so happens that strip is implemented in this extension.
Losing the named patch just to be able to make changes to it seems like 
a downside of git stash.

Frank
-- 
------------------------------------------------------------------------
Frank A. Kingswood                      frank at kingswood-consulting.co.uk
Cambridge, United Kingdom                               +44-7545-209 100




More information about the Mercurial mailing list