Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For Mercurial, can we push some changesets and don't push some?

Tags:

mercurial

If we committed several times, for example, on our local repo, for revision 3000, 3001, 3002, 3003. If we push to a remote repo, it will push 3000 to 3003. Is there a way to push only 3000 and 3001?

like image 548
nonopolarity Avatar asked Oct 25 '10 15:10

nonopolarity


People also ask

How do I roll back a commit in Mercurial?

If you want to revert just the latest commit use: hg strip --keep -r . Using strip will revert the state of your files to the specified commit but you will have them as pending changes, so you can apply them together with your file to a new commit.

What does hg commit do?

Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed.


3 Answers

Yes, you can select a revision to push. hg push -r 3001 (all ancestors of the chosen revision will be pushed; you don't need to specify 3000.)

like image 177
Wooble Avatar answered Sep 30 '22 21:09

Wooble


If you need to push some changesets without all ancestors (solution described in @Woolble's answer), a good option is to use Mercurial Queues extension (MQ).

https://www.mercurial-scm.org/wiki/MqExtension

This will let you re-order and even combine changesets so you can push them in whatever order you like. It takes a bit of work to get started but you'll find it well worth the effort.

I've TortoiseHg makes working with MQ pretty straightforward.

like image 27
Nick Pierpoint Avatar answered Sep 26 '22 21:09

Nick Pierpoint


For those who are using UI and like pictures:

  1. In TortoiseHg click on Detect outgoing changes to button. enter image description here

  2. Click right mouse button on revision you want to push.

  3. Choose Push -> Push to Here. enter image description here

Result: You will push only revision selected rather than everything. enter image description here

Hope this saves you some time.

like image 35
Matas Vaitkevicius Avatar answered Sep 26 '22 21:09

Matas Vaitkevicius