Lemme see if have the scenario correct. You have...
- some uncommitted edits in your working directory that you'd rather not commit yet,
- some unpushed changes in your local repository,
...but your annoying boss taps you on the back and says, "Hey! When are you going to push that change you mentioned in the staff meeting? We're all waiting for it!" He's standing there waiting for you do it, so how do you get him out of your hair quickly and easily?
This is easy. You want to be using the MQ extension. It's bundled with the standard Mercurial installation.
First add it to your .hgrc
file.
[extensions]
mq =
To stash your uncommitted edits in a patch queue entry, do this:
$ hg qnew stash
$ hg qpop
Now push your older commits, so your boss will get off your back.
$ hg push
Finally, restore your working directory like so:
$ hg qpush
At this point, you still have the patch recorded in your patch queue. It's just marked as "applied" now. Finish editing your code, then do this to update the patch with your finished edits and a commit log message, then finalize the patch into a changeset:
$ hg qrefresh -m"Commit message goes here."
$ hg qfinish stash
That's the basics, but there's a whole lot more you can do if you want to get really fancy. The MQ extension is like a whole new world of revision control hiding underneath the Mercurial repository. It's like the Git stash, but more flexible and marginally less confusing.
Learn, mutate, evolve!