Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branching in Mercurial

I have starting using Mercurial for my (our) versioning needs. I have now come to the point that I need to create a feature branch. However, now that I have started working on it -- and I try to push my changes, I keep getting a warning about new remote heads. That's stupid, I know that there will be new remote head(s) that's what a branch after all is?

How am I supposed to create branches and push them without this problem, without using force push as it is surely not the right way to go, right?

I thought about using separate repositories, but that feels just stupid especially for feature branches.

Any help welcome!

like image 708
Tower Avatar asked Nov 30 '10 19:11

Tower


1 Answers

To date, the best guide out there is Steve Losh's "A Guide to Branching in Mercurial".

Mercurial will always complain about creating new heads on the remote. You must use either --force or --new-branch when creating a new head.

When using TortoiseHg, the same can be accomplished via the Synchronize view of the Workbench. Click Options and then select the Allow push of a new branch or Force push or pull option, as needed.

TortoiseHg v2.x

The reason it behaves this is way is that the Mercurial developers wanted to make it a conscious decision to create a new head on the remote. Their view is that typical workflows should merge changes prior to pushing.

like image 105
Tim Henigan Avatar answered Sep 19 '22 03:09

Tim Henigan